From d1cd99244f96bd95bbd67cc737248df346dec08b Mon Sep 17 00:00:00 2001 From: egor-tensin Date: Thu, 25 Apr 2024 03:50:51 +0000 Subject: =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20egor-tensin/cimp?= =?UTF-8?q?le@8e652dd2cb69928ea1596aa3e59845fef6854e2c=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...dex.log.c.47179e5db7ed3f2db741c99372ba24f3.html | 539 +++++++++++++++++++++ 1 file changed, 539 insertions(+) create mode 100644 coverage/index.log.c.47179e5db7ed3f2db741c99372ba24f3.html (limited to 'coverage/index.log.c.47179e5db7ed3f2db741c99372ba24f3.html') diff --git a/coverage/index.log.c.47179e5db7ed3f2db741c99372ba24f3.html b/coverage/index.log.c.47179e5db7ed3f2db741c99372ba24f3.html new file mode 100644 index 0000000..0b70801 --- /dev/null +++ b/coverage/index.log.c.47179e5db7ed3f2db741c99372ba24f3.html @@ -0,0 +1,539 @@ + + + + + + GCC Code Coverage Report + + + + + +

GCC Code Coverage Report

+ +
+ +
+
+ + + + + + + + + + + + + +
Directory:src/
File:src/log.c
Date:2024-04-25 03:45:42
+
+
+ + + + + + + + + + + + + + + + + + + +
ExecTotalCoverage
Lines:222491.7%
Branches:4666.7%
+
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineBranchExecSource
1 + /*
2 + * Copyright (c) 2023 Egor Tensin <egor@tensin.name>
3 + * This file is part of the "cimple" project.
4 + * For details, see https://github.com/egor-tensin/cimple.
5 + * Distributed under the MIT License.
6 + */
7 +
8 + #include "log.h"
9 +
10 + #include <stdio.h>
11 + #include <sys/time.h>
12 + #include <time.h>
13 + #include <unistd.h>
14 +
15 + int g_log_lvl = LOG_LVL_INFO;
16 +
17 + 182861static inline void log_prefix_timestamp(FILE *dest)
18 + {
19 + struct timeval tv;
20 + struct tm tm;
21 + char buf[64];
22 + 182861 size_t used = 0;
23 +
24 +
+ 1/2 +
+
✗ Branch 1 not taken.
+
✓ Branch 2 taken 182861 times.
+
+
+
182861 if (gettimeofday(&tv, NULL) < 0)
25 + return;
26 +
+ 1/2 +
+
✗ Branch 1 not taken.
+
✓ Branch 2 taken 182861 times.
+
+
+
182861 if (!gmtime_r(&tv.tv_sec, &tm))
27 + return;
28 +
29 + 182861 buf[0] = '\0';
30 + 182861 used += strftime(buf + used, sizeof(buf) - used, "%F %T", &tm);
31 + 182861 long long msec = (long long)tv.tv_usec / 1000;
32 + 182861 used += snprintf(buf + used, sizeof(buf) - used, ".%03lld | ", msec);
33 + 182861 fprintf(dest, "%s", buf);
34 + }
35 +
36 + 182861static inline void log_prefix_thread_id(FILE *dest)
37 + {
38 + 182861 fprintf(dest, "%d | ", gettid());
39 + 182861}
40 +
41 + 708199int log_entry_start(int lvl, FILE *dest)
42 + {
43 +
+ 2/2 +
+
✓ Branch 0 taken 525338 times.
+
✓ Branch 1 taken 182861 times.
+
+
+
708199 if (lvl < g_log_lvl)
44 + 525338 return 0;
45 + 182861 flockfile(dest);
46 + 182861 log_prefix_timestamp(dest);
47 + 182861 log_prefix_thread_id(dest);
48 + 182861 return 1;
49 + }
50 +
51 + 182861void log_entry_end(FILE *dest)
52 + {
53 + 182861 funlockfile(dest);
54 + 182861}
55 +
+
+ +
+ + + + -- cgit v1.2.3