blob: 0b70801dddc94f65562361bd77d51903a5a7c6f4 (
plain) (
tree)
|
|
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>GCC Code Coverage Report</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="index.css">
</head>
<body>
<h1>GCC Code Coverage Report</h1>
<hr/>
<div class="summary">
<div>
<table class="legend">
<tr>
<th scope="row">Directory:</th>
<td>src/</td>
</tr>
<tr>
<th scope="row">File:</th>
<td>src/log.c</td>
</tr>
<tr>
<th scope="row">Date:</th>
<td>2024-04-25 03:45:42</td>
</tr>
</table>
</div>
<div>
<table class="coverage">
<tr>
<th></th>
<th scope="col">Exec</th>
<th scope="col">Total</th>
<th scope="col">Coverage</th>
</tr>
<tr>
<th scope="row">Lines:</th>
<td>22</td>
<td>24</td>
<td class="coverage-high">91.7%</td>
</tr>
<tr>
<th scope="row">Branches:</th>
<td>4</td>
<td>6</td>
<td class="coverage-low">66.7%</td>
</tr>
</table>
</div>
</div>
<hr/>
<div class="file-source">
<table>
<tr>
<th align="right">Line</th>
<th align="right">Branch</th>
<th align="right">Exec</th>
<th align="left">Source</th>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l1" href="#l1">1</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "><span class="cm">/*</span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l2" href="#l2">2</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "><span class="cm"> * Copyright (c) 2023 Egor Tensin <egor@tensin.name></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l3" href="#l3">3</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "><span class="cm"> * This file is part of the "cimple" project.</span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l4" href="#l4">4</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "><span class="cm"> * For details, see https://github.com/egor-tensin/cimple.</span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l5" href="#l5">5</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "><span class="cm"> * Distributed under the MIT License.</span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l6" href="#l6">6</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "><span class="cm"> */</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l7" href="#l7">7</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l8" href="#l8">8</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "><span class="cp">#include</span><span class="w"> </span><span class="cpf">"log.h"</span><span class="cp"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l9" href="#l9">9</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l10" href="#l10">10</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "><span class="cp">#include</span><span class="w"> </span><span class="cpf"><stdio.h></span><span class="cp"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l11" href="#l11">11</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "><span class="cp">#include</span><span class="w"> </span><span class="cpf"><sys/time.h></span><span class="cp"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l12" href="#l12">12</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "><span class="cp">#include</span><span class="w"> </span><span class="cpf"><time.h></span><span class="cp"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l13" href="#l13">13</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "><span class="cp">#include</span><span class="w"> </span><span class="cpf"><unistd.h></span><span class="cp"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l14" href="#l14">14</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l15" href="#l15">15</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "><span class="kt">int</span><span class="w"> </span><span class="n">g_log_lvl</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">LOG_LVL_INFO</span><span class="p">;</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l16" href="#l16">16</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l17" href="#l17">17</a></td>
<td class="linebranch">
</td>
<td class="linecount coveredLine">182861</td>
<td class="src coveredLine"><span class="k">static</span><span class="w"> </span><span class="kr">inline</span><span class="w"> </span><span class="kt">void</span><span class="w"> </span><span class="nf">log_prefix_timestamp</span><span class="p">(</span><span class="kt">FILE</span><span class="w"> </span><span class="o">*</span><span class="n">dest</span><span class="p">)</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l18" href="#l18">18</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "><span class="p">{</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l19" href="#l19">19</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "><span class="w"> </span><span class="k">struct</span><span class="w"> </span><span class="nc">timeval</span><span class="w"> </span><span class="n">tv</span><span class="p">;</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l20" href="#l20">20</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "><span class="w"> </span><span class="k">struct</span><span class="w"> </span><span class="nc">tm</span><span class="w"> </span><span class="n">tm</span><span class="p">;</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l21" href="#l21">21</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "><span class="w"> </span><span class="kt">char</span><span class="w"> </span><span class="n">buf</span><span class="p">[</span><span class="mi">64</span><span class="p">];</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l22" href="#l22">22</a></td>
<td class="linebranch">
</td>
<td class="linecount coveredLine">182861</td>
<td class="src coveredLine"><span class="w"> </span><span class="kt">size_t</span><span class="w"> </span><span class="n">used</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l23" href="#l23">23</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l24" href="#l24">24</a></td>
<td class="linebranch">
<details class="linebranchDetails">
<summary class="linebranchSummary">1/2</summary>
<div class="linebranchContents">
<div class="notTakenBranch">✗ Branch 1 not taken.</div>
<div class="takenBranch">✓ Branch 2 taken 182861 times.</div>
</div>
</details>
</td>
<td class="linecount coveredLine">182861</td>
<td class="src coveredLine"><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">gettimeofday</span><span class="p">(</span><span class="o">&</span><span class="n">tv</span><span class="p">,</span><span class="w"> </span><span class="nb">NULL</span><span class="p">)</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="mi">0</span><span class="p">)</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l25" href="#l25">25</a></td>
<td class="linebranch">
</td>
<td class="linecount uncoveredLine">✗</td>
<td class="src uncoveredLine"><span class="w"> </span><span class="k">return</span><span class="p">;</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l26" href="#l26">26</a></td>
<td class="linebranch">
<details class="linebranchDetails">
<summary class="linebranchSummary">1/2</summary>
<div class="linebranchContents">
<div class="notTakenBranch">✗ Branch 1 not taken.</div>
<div class="takenBranch">✓ Branch 2 taken 182861 times.</div>
</div>
</details>
</td>
<td class="linecount coveredLine">182861</td>
<td class="src coveredLine"><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="o">!</span><span class="n">gmtime_r</span><span class="p">(</span><span class="o">&</span><span class="n">tv</span><span class="p">.</span><span class="n">tv_sec</span><span class="p">,</span><span class="w"> </span><span class="o">&</span><span class="n">tm</span><span class="p">))</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l27" href="#l27">27</a></td>
<td class="linebranch">
</td>
<td class="linecount uncoveredLine">✗</td>
<td class="src uncoveredLine"><span class="w"> </span><span class="k">return</span><span class="p">;</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l28" href="#l28">28</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l29" href="#l29">29</a></td>
<td class="linebranch">
</td>
<td class="linecount coveredLine">182861</td>
<td class="src coveredLine"><span class="w"> </span><span class="n">buf</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="sc">'\0'</span><span class="p">;</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l30" href="#l30">30</a></td>
<td class="linebranch">
</td>
<td class="linecount coveredLine">182861</td>
<td class="src coveredLine"><span class="w"> </span><span class="n">used</span><span class="w"> </span><span class="o">+=</span><span class="w"> </span><span class="n">strftime</span><span class="p">(</span><span class="n">buf</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">used</span><span class="p">,</span><span class="w"> </span><span class="k">sizeof</span><span class="p">(</span><span class="n">buf</span><span class="p">)</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="n">used</span><span class="p">,</span><span class="w"> </span><span class="s">"%F %T"</span><span class="p">,</span><span class="w"> </span><span class="o">&</span><span class="n">tm</span><span class="p">);</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l31" href="#l31">31</a></td>
<td class="linebranch">
</td>
<td class="linecount coveredLine">182861</td>
<td class="src coveredLine"><span class="w"> </span><span class="kt">long</span><span class="w"> </span><span class="kt">long</span><span class="w"> </span><span class="n">msec</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">(</span><span class="kt">long</span><span class="w"> </span><span class="kt">long</span><span class="p">)</span><span class="n">tv</span><span class="p">.</span><span class="n">tv_usec</span><span class="w"> </span><span class="o">/</span><span class="w"> </span><span class="mi">1000</span><span class="p">;</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l32" href="#l32">32</a></td>
<td class="linebranch">
</td>
<td class="linecount coveredLine">182861</td>
<td class="src coveredLine"><span class="w"> </span><span class="n">used</span><span class="w"> </span><span class="o">+=</span><span class="w"> </span><span class="n">snprintf</span><span class="p">(</span><span class="n">buf</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="n">used</span><span class="p">,</span><span class="w"> </span><span class="k">sizeof</span><span class="p">(</span><span class="n">buf</span><span class="p">)</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="n">used</span><span class="p">,</span><span class="w"> </span><span class="s">".%03lld | "</span><span class="p">,</span><span class="w"> </span><span class="n">msec</span><span class="p">);</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l33" href="#l33">33</a></td>
<td class="linebranch">
</td>
<td class="linecount coveredLine">182861</td>
<td class="src coveredLine"><span class="w"> </span><span class="n">fprintf</span><span class="p">(</span><span class="n">dest</span><span class="p">,</span><span class="w"> </span><span class="s">"%s"</span><span class="p">,</span><span class="w"> </span><span class="n">buf</span><span class="p">);</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l34" href="#l34">34</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "><span class="p">}</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l35" href="#l35">35</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l36" href="#l36">36</a></td>
<td class="linebranch">
</td>
<td class="linecount coveredLine">182861</td>
<td class="src coveredLine"><span class="k">static</span><span class="w"> </span><span class="kr">inline</span><span class="w"> </span><span class="kt">void</span><span class="w"> </span><span class="nf">log_prefix_thread_id</span><span class="p">(</span><span class="kt">FILE</span><span class="w"> </span><span class="o">*</span><span class="n">dest</span><span class="p">)</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l37" href="#l37">37</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "><span class="p">{</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l38" href="#l38">38</a></td>
<td class="linebranch">
</td>
<td class="linecount coveredLine">182861</td>
<td class="src coveredLine"><span class="w"> </span><span class="n">fprintf</span><span class="p">(</span><span class="n">dest</span><span class="p">,</span><span class="w"> </span><span class="s">"%d | "</span><span class="p">,</span><span class="w"> </span><span class="n">gettid</span><span class="p">());</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l39" href="#l39">39</a></td>
<td class="linebranch">
</td>
<td class="linecount coveredLine">182861</td>
<td class="src coveredLine"><span class="p">}</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l40" href="#l40">40</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l41" href="#l41">41</a></td>
<td class="linebranch">
</td>
<td class="linecount coveredLine">708199</td>
<td class="src coveredLine"><span class="kt">int</span><span class="w"> </span><span class="nf">log_entry_start</span><span class="p">(</span><span class="kt">int</span><span class="w"> </span><span class="n">lvl</span><span class="p">,</span><span class="w"> </span><span class="kt">FILE</span><span class="w"> </span><span class="o">*</span><span class="n">dest</span><span class="p">)</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l42" href="#l42">42</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "><span class="p">{</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l43" href="#l43">43</a></td>
<td class="linebranch">
<details class="linebranchDetails">
<summary class="linebranchSummary">2/2</summary>
<div class="linebranchContents">
<div class="takenBranch">✓ Branch 0 taken 525338 times.</div>
<div class="takenBranch">✓ Branch 1 taken 182861 times.</div>
</div>
</details>
</td>
<td class="linecount coveredLine">708199</td>
<td class="src coveredLine"><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="n">lvl</span><span class="w"> </span><span class="o"><</span><span class="w"> </span><span class="n">g_log_lvl</span><span class="p">)</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l44" href="#l44">44</a></td>
<td class="linebranch">
</td>
<td class="linecount coveredLine">525338</td>
<td class="src coveredLine"><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l45" href="#l45">45</a></td>
<td class="linebranch">
</td>
<td class="linecount coveredLine">182861</td>
<td class="src coveredLine"><span class="w"> </span><span class="n">flockfile</span><span class="p">(</span><span class="n">dest</span><span class="p">);</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l46" href="#l46">46</a></td>
<td class="linebranch">
</td>
<td class="linecount coveredLine">182861</td>
<td class="src coveredLine"><span class="w"> </span><span class="n">log_prefix_timestamp</span><span class="p">(</span><span class="n">dest</span><span class="p">);</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l47" href="#l47">47</a></td>
<td class="linebranch">
</td>
<td class="linecount coveredLine">182861</td>
<td class="src coveredLine"><span class="w"> </span><span class="n">log_prefix_thread_id</span><span class="p">(</span><span class="n">dest</span><span class="p">);</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l48" href="#l48">48</a></td>
<td class="linebranch">
</td>
<td class="linecount coveredLine">182861</td>
<td class="src coveredLine"><span class="w"> </span><span class="k">return</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l49" href="#l49">49</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "><span class="p">}</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l50" href="#l50">50</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l51" href="#l51">51</a></td>
<td class="linebranch">
</td>
<td class="linecount coveredLine">182861</td>
<td class="src coveredLine"><span class="kt">void</span><span class="w"> </span><span class="nf">log_entry_end</span><span class="p">(</span><span class="kt">FILE</span><span class="w"> </span><span class="o">*</span><span class="n">dest</span><span class="p">)</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l52" href="#l52">52</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "><span class="p">{</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l53" href="#l53">53</a></td>
<td class="linebranch">
</td>
<td class="linecount coveredLine">182861</td>
<td class="src coveredLine"><span class="w"> </span><span class="n">funlockfile</span><span class="p">(</span><span class="n">dest</span><span class="p">);</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l54" href="#l54">54</a></td>
<td class="linebranch">
</td>
<td class="linecount coveredLine">182861</td>
<td class="src coveredLine"><span class="p">}</span><span class="w"></span></td>
</tr>
<tr class="source-line">
<td class="lineno"><a id="l55" href="#l55">55</a></td>
<td class="linebranch">
</td>
<td class="linecount "></td>
<td class="src "></td>
</tr>
</table>
</div>
<hr/>
<footer>
Generated by: <a href="http://gcovr.com">GCOVR (Version 5.0)</a>
</footer>
</body>
</html>
|