From 91f8798bf240d55fabc021739239d95bdcb1b4d4 Mon Sep 17 00:00:00 2001 From: egor-tensin Date: Thu, 26 Dec 2024 11:18:27 +0000 Subject: =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20egor-tensin/cimp?= =?UTF-8?q?le@9f40d20e1c97e2c85e26a6a13ccf04e60d9f83f5=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 | 509 +++++++++++++++++++++ 1 file changed, 509 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..493aec2 --- /dev/null +++ b/coverage/index.log.c.47179e5db7ed3f2db741c99372ba24f3.html @@ -0,0 +1,509 @@ + + + + + + GCC Code Coverage Report + + + + + +
+

GCC Code Coverage Report

+ +
+ +
+
+ + + + + + + + + + + + + +
Directory:src/
File:src/log.c
Date:2024-12-26 11:11:59
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
ExecTotalCoverage
Lines:222491.7%
Functions:44100.0%
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 + 181825static inline void log_prefix_timestamp(FILE *dest)
18 + {
19 + struct timeval tv;
20 + struct tm tm;
21 + char buf[64];
22 + 181825 size_t used = 0;
23 +
24 +
+ 1/2 +
+
✗ Branch 1 not taken.
+
✓ Branch 2 taken 181825 times.
+
+
+
181825 if (gettimeofday(&tv, NULL) < 0)
25 + return;
26 +
+ 1/2 +
+
✗ Branch 1 not taken.
+
✓ Branch 2 taken 181825 times.
+
+
+
181825 if (!gmtime_r(&tv.tv_sec, &tm))
27 + return;
28 +
29 + 181825 buf[0] = '\0';
30 + 181825 used += strftime(buf + used, sizeof(buf) - used, "%F %T", &tm);
31 + 181825 long long msec = (long long)tv.tv_usec / 1000;
32 + 181825 used += snprintf(buf + used, sizeof(buf) - used, ".%03lld | ", msec);
33 + 181825 fprintf(dest, "%s", buf);
34 + }
35 +
36 + 181825static inline void log_prefix_thread_id(FILE *dest)
37 + {
38 + 181825 fprintf(dest, "%d | ", gettid());
39 + 181825}
40 +
41 + 740909int log_entry_start(int lvl, FILE *dest)
42 + {
43 +
+ 2/2 +
+
✓ Branch 0 taken 559084 times.
+
✓ Branch 1 taken 181825 times.
+
+
+
740909 if (lvl < g_log_lvl)
44 + 559084 return 0;
45 + 181825 flockfile(dest);
46 + 181825 log_prefix_timestamp(dest);
47 + 181825 log_prefix_thread_id(dest);
48 + 181825 return 1;
49 + }
50 +
51 + 181825void log_entry_end(FILE *dest)
52 + {
53 + 181825 funlockfile(dest);
54 + 181825}
55 +
+
+
+
+ + + + -- cgit v1.2.3