]> git.ipfire.org Git - people/ms/libloc.git/commitdiff
database: Benchmark time it takes to verify the signature
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 29 Nov 2019 18:56:25 +0000 (18:56 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 29 Nov 2019 18:56:25 +0000 (18:56 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/database.c

index 9fd7c708d5bad517120709346223c433c08941ad..f126c607c48d1aea35de4e0329552b10a2aff561 100644 (file)
@@ -436,6 +436,9 @@ LOC_EXPORT int loc_database_verify(struct loc_database* db, FILE* f) {
                return 1;
        }
 
+       // Start the stopwatch
+       clock_t start = clock();
+
        // Load public key
        EVP_PKEY* pkey = PEM_read_PUBKEY(f, NULL, NULL, NULL);
        if (!pkey) {
@@ -507,6 +510,10 @@ LOC_EXPORT int loc_database_verify(struct loc_database* db, FILE* f) {
                        ERR_error_string(ERR_get_error(), NULL));
        }
 
+       clock_t end = clock();
+       DEBUG(db->ctx, "Signature checked in %.4fms\n",
+               (double)(end - start) / CLOCKS_PER_SEC * 1000);
+
 CLEANUP:
        // Cleanup
        EVP_MD_CTX_free(mdctx);