Line data Source code
1 : /* File: data_stat.c; Copyright and License: see below */
2 :
3 : #include "set/data_stat.h"
4 : #include "u8/u8_trace.h"
5 : #include <assert.h>
6 :
7 : /*! human readable list of stat-categories for trace output */
8 : static const char *const ( data_stat_private_series[(int)DATA_STAT_SERIES_MAX] )
9 : = { "CREX", "MODI", "DELE", "IGNO", "WARN", "ERR_" };
10 :
11 5 : void data_stat_trace ( const data_stat_t *this_ )
12 : {
13 5 : U8_TRACE_BEGIN();
14 5 : U8_TRACE_INFO( " l C F R E D" );
15 35 : for ( int series_idx = 0; series_idx < DATA_STAT_SERIES_MAX; series_idx ++ )
16 : {
17 30 : const char prefix[] = "data_stat_t[";
18 30 : const char infix1[] = "]: ";
19 : char stat_buf[sizeof(prefix)-1+4+sizeof(infix1)-1+3+5*DATA_STAT_TABLE_MAX];
20 30 : utf8stringbuf_t stat_str = UTF8STRINGBUF( stat_buf );
21 30 : utf8stringbuf_copy_str( &stat_str, prefix );
22 30 : utf8stringbuf_append_str( &stat_str, data_stat_private_series[series_idx] );
23 30 : utf8stringbuf_append_str( &stat_str, infix1 );
24 :
25 210 : for ( int tables_idx = 0; tables_idx < DATA_STAT_TABLE_MAX; tables_idx ++ )
26 : {
27 180 : utf8stringbuf_append_str( &stat_str, (tables_idx==0)?"":"," );
28 180 : utf8stringbuf_append_int( &stat_str, (*this_).data[tables_idx][series_idx] );
29 : }
30 30 : U8_TRACE_INFO( utf8stringbuf_get_string( &stat_str ) );
31 : }
32 5 : U8_TRACE_END();
33 5 : }
34 :
35 :
36 : /*
37 : Copyright 2020-2025 Andreas Warnke
38 :
39 : Licensed under the Apache License, Version 2.0 (the "License");
40 : you may not use this file except in compliance with the License.
41 : You may obtain a copy of the License at
42 :
43 : http://www.apache.org/licenses/LICENSE-2.0
44 :
45 : Unless required by applicable law or agreed to in writing, software
46 : distributed under the License is distributed on an "AS IS" BASIS,
47 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
48 : See the License for the specific language governing permissions and
49 : limitations under the License.
50 : */
|