]> git.ipfire.org Git - pakfire.git/commitdiff
Log time it took to solve a request
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 13 Jan 2018 14:01:22 +0000 (15:01 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 13 Jan 2018 14:01:22 +0000 (15:01 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/request.c

index a1dbb33508f624495719e7c7d7e2471d2b778ecf..669121bbf67d9bdb2147cd86f175932068652643 100644 (file)
@@ -26,6 +26,7 @@
 # include <solv/solverdebug.h>
 #endif
 
+#include <pakfire/logging.h>
 #include <pakfire/package.h>
 #include <pakfire/private.h>
 #include <pakfire/problem.h>
@@ -114,6 +115,9 @@ static int solve(PakfireRequest request, Queue* queue) {
 
        pakfire_pool_apply_changes(request->pool);
 
+       // Save time when we starting solving
+       clock_t solving_start = clock();
+
        if (solver_solve(request->solver, queue)) {
 #ifdef DEBUG
                solver_printallsolutions(request->solver);
@@ -122,6 +126,12 @@ static int solve(PakfireRequest request, Queue* queue) {
                return 1;
        }
 
+       // Save time when we finished solving
+       clock_t solving_end = clock();
+
+       DEBUG("Solved request in %.4fms\n",
+               (double)(solving_end - solving_start) * 1000 / CLOCKS_PER_SEC);
+
        /* If the solving process was successful, we get the transaction
         * from the solver. */
        request->transaction = solver_create_transaction(request->solver);