Skip to content

Commit

Permalink
debug: add new dubug level SSSDBG_PERF_STAT
Browse files Browse the repository at this point in the history
SSSDBG_PERF_STAT should be use for statistical or performance data, e.g
time needed for a request.

:relnote: A new debug level is added to show statistical and performance
data. Currently the duration of a backend request and of single LDAP
operations are recorded if debug_level is set to 9 or the bit 0x20000 is
set.

Resolves: #5967

Reviewed-by: Alexey Tikhonov <atikhono@redhat.com>
  • Loading branch information
sumit-bose authored and pbrezina committed Feb 15, 2022
1 parent 3935e89 commit 775150b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/man/include/debug_levels.xml
Expand Up @@ -77,6 +77,13 @@
<emphasis>9</emphasis>,
<emphasis>0x4000</emphasis>: Extremely low-level tracing information.
</para>
<para>
<emphasis>9</emphasis>,
<emphasis>0x20000</emphasis>: Performance and statistical data,
please note that due to the way requests are processed internally the
logged execution time of a request might be longer than it actually
was.
</para>
<para>
<emphasis>10</emphasis>,
<emphasis>0x10000</emphasis>: Even more low-level libldb tracing
Expand Down
2 changes: 1 addition & 1 deletion src/tests/debug-tests.c
Expand Up @@ -50,7 +50,7 @@ START_TEST(test_debug_convert_old_level_old_format)
SSSDBG_TRACE_FUNC,
SSSDBG_TRACE_LIBS,
SSSDBG_TRACE_INTERNAL,
SSSDBG_TRACE_ALL | SSSDBG_BE_FO,
SSSDBG_TRACE_ALL | SSSDBG_BE_FO | SSSDBG_PERF_STAT,
SSSDBG_TRACE_LDB
};

Expand Down
2 changes: 1 addition & 1 deletion src/util/debug.c
Expand Up @@ -191,7 +191,7 @@ int debug_convert_old_level(int old_level)
new_level |= SSSDBG_TRACE_INTERNAL;

if (old_level >= 9)
new_level |= SSSDBG_TRACE_ALL | SSSDBG_BE_FO;
new_level |= SSSDBG_TRACE_ALL | SSSDBG_BE_FO | SSSDBG_PERF_STAT;

if (old_level >= 10)
new_level |= SSSDBG_TRACE_LDB;
Expand Down
3 changes: 2 additions & 1 deletion src/util/debug.h
Expand Up @@ -112,13 +112,14 @@ int rotate_debug_files(void);
#define SSSDBG_TRACE_ALL 0x4000 /* level 9 */
#define SSSDBG_BE_FO 0x8000 /* level 9 */
#define SSSDBG_TRACE_LDB 0x10000 /* level 10 */
#define SSSDBG_PERF_STAT 0x20000 /* level 9 */

/* IMPORTANT_INFO will be logged if any of bits >= OP_FAILURE are on: */
#define SSSDBG_IMPORTANT_INFO (SSSDBG_OP_FAILURE|SSSDBG_MINOR_FAILURE|\
SSSDBG_CONF_SETTINGS|SSSDBG_FUNC_DATA|\
SSSDBG_TRACE_FUNC|SSSDBG_TRACE_LIBS|\
SSSDBG_TRACE_INTERNAL|SSSDBG_TRACE_ALL|\
SSSDBG_BE_FO|SSSDBG_TRACE_LDB)
SSSDBG_BE_FO|SSSDBG_TRACE_LDB|SSSDBG_PERF_STAT)

#define SSSDBG_INVALID -1
#define SSSDBG_UNRESOLVED 0
Expand Down

0 comments on commit 775150b

Please sign in to comment.