From: Victor Julien Date: Tue, 4 Feb 2014 11:53:00 +0000 (+0100) Subject: profiling: output log api modules separately X-Git-Tag: suricata-2.0rc1~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6dd10443ce6e91503a9188021d54137e9ea4860d;p=thirdparty%2Fsuricata.git profiling: output log api modules separately Skip log api thread modules in the regular 'thread modules' list, instead print them in a separate list. --- diff --git a/src/util-profiling.c b/src/util-profiling.c index 085f39b4b7..f85b64c98a 100644 --- a/src/util-profiling.c +++ b/src/util-profiling.c @@ -383,6 +383,9 @@ void SCProfilingDumpPacketStats(void) { int m; total = 0; for (m = 0; m < TMM_SIZE; m++) { + if (tmm_modules[m].flags & TM_FLAG_LOGAPI_TM) + continue; + int p; for (p = 0; p < 257; p++) { SCProfilePacketData *pd = &packet_profile_tmm_data4[m][p]; @@ -394,6 +397,9 @@ void SCProfilingDumpPacketStats(void) { } for (m = 0; m < TMM_SIZE; m++) { + if (tmm_modules[m].flags & TM_FLAG_LOGAPI_TM) + continue; + int p; for (p = 0; p < 257; p++) { SCProfilePacketData *pd = &packet_profile_tmm_data4[m][p]; @@ -418,6 +424,9 @@ void SCProfilingDumpPacketStats(void) { } for (m = 0; m < TMM_SIZE; m++) { + if (tmm_modules[m].flags & TM_FLAG_LOGAPI_TM) + continue; + int p; for (p = 0; p < 257; p++) { SCProfilePacketData *pd = &packet_profile_tmm_data6[m][p]; @@ -529,6 +538,87 @@ void SCProfilingDumpPacketStats(void) { total += pd->tot; } } + + + fprintf(fp, "\n%-24s %-6s %-5s %-12s %-12s %-12s %-12s %-12s %-3s", + "Log Thread Module", "IP ver", "Proto", "cnt", "min", "max", "avg", "tot", "%%"); +#ifdef PROFILE_LOCKING + fprintf(fp, " %-10s %-10s %-12s %-12s %-10s %-10s %-12s %-12s\n", + "locks", "ticks", "cont.", "cont.avg", "slocks", "sticks", "scont.", "scont.avg"); +#else + fprintf(fp, "\n"); +#endif + fprintf(fp, "%-24s %-6s %-5s %-12s %-12s %-12s %-12s %-12s %-3s", + "------------------------", "------", "-----", "----------", "------------", "------------", "-----------", "-----------", "---"); +#ifdef PROFILE_LOCKING + fprintf(fp, " %-10s %-10s %-12s %-12s %-10s %-10s %-12s %-12s\n", + "--------", "--------", "----------", "-----------", "--------", "--------", "------------", "-----------"); +#else + fprintf(fp, "\n"); +#endif + total = 0; + for (m = 0; m < TMM_SIZE; m++) { + if (!(tmm_modules[m].flags & TM_FLAG_LOGAPI_TM)) + continue; + + int p; + for (p = 0; p < 257; p++) { + SCProfilePacketData *pd = &packet_profile_tmm_data4[m][p]; + total += pd->tot; + + pd = &packet_profile_tmm_data6[m][p]; + total += pd->tot; + } + } + + for (m = 0; m < TMM_SIZE; m++) { + if (!(tmm_modules[m].flags & TM_FLAG_LOGAPI_TM)) + continue; + + int p; + for (p = 0; p < 257; p++) { + SCProfilePacketData *pd = &packet_profile_tmm_data4[m][p]; + + if (pd->cnt == 0) { + continue; + } + + FormatNumber(pd->tot, totalstr, sizeof(totalstr)); + double percent = (long double)pd->tot / + (long double)total * 100; + + fprintf(fp, "%-24s IPv4 %3d %12"PRIu64" %12"PRIu64" %12"PRIu64" %12"PRIu64" %12s %6.2f", + TmModuleTmmIdToString(m), p, pd->cnt, pd->min, pd->max, (uint64_t)(pd->tot / pd->cnt), totalstr, percent); +#ifdef PROFILE_LOCKING + fprintf(fp, " %10.2f %12"PRIu64" %12"PRIu64" %10.2f %10.2f %12"PRIu64" %12"PRIu64" %10.2f\n", + (float)pd->lock/pd->cnt, (uint64_t)pd->ticks/pd->cnt, pd->contention, (float)pd->contention/pd->cnt, (float)pd->slock/pd->cnt, (uint64_t)pd->sticks/pd->cnt, pd->scontention, (float)pd->scontention/pd->cnt); +#else + fprintf(fp, "\n"); +#endif + } + } + + for (m = 0; m < TMM_SIZE; m++) { + if (!(tmm_modules[m].flags & TM_FLAG_LOGAPI_TM)) + continue; + + int p; + for (p = 0; p < 257; p++) { + SCProfilePacketData *pd = &packet_profile_tmm_data6[m][p]; + + if (pd->cnt == 0) { + continue; + } + + FormatNumber(pd->tot, totalstr, sizeof(totalstr)); + double percent = (long double)pd->tot / + (long double)total * 100; + + fprintf(fp, "%-24s IPv6 %3d %12"PRIu64" %12"PRIu64" %12"PRIu64" %12"PRIu64" %12s %6.2f\n", + TmModuleTmmIdToString(m), p, pd->cnt, pd->min, pd->max, (uint64_t)(pd->tot / pd->cnt), totalstr, percent); + } + } + fprintf(fp, "\nGeneral detection engine stats:\n"); total = 0;