MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / getPerfCounters

Method getPerfCounters

src/yvalve/perf.cpp:446–596  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

444} // anonymous namespace
445
446void Why::UtilInterface::getPerfCounters(Firebird::CheckStatusWrapper* status,
447 Firebird::IAttachment* att, const char* countersSet, ISC_INT64* counters)
448{
449 try
450 {
451 // Parse countersSet
452 unsigned cntLink[TOTAL_COUNTERS];
453 memset(cntLink, 0xFF, sizeof cntLink);
454 Firebird::string dupSet(countersSet);
455 char* set = dupSet.begin();
456 char* save = NULL;
457 const char* delim = " \t,;";
458 unsigned typeMask = 0;
459 unsigned n = 0;
460 UCHAR info[TOTAL_COUNTERS]; // will never use all, but do not care about few bytes
461 UCHAR* pinfo = info;
462
463#ifdef WIN_NT
464#define strtok_r strtok_s
465#endif
466
467 for (char* nm = strtok_r(set, delim, &save); nm; nm = strtok_r(NULL, delim, &save))
468 {
469 Firebird::NoCaseString name(nm);
470
471 for (unsigned i = 0; i < TOTAL_COUNTERS; ++i)
472 {
473 if (name == knownCounters[i].name)
474 {
475 if (cntLink[i] != ~0u)
476 (Firebird::Arg::Gds(isc_random) << "Duplicated name").raise(); //report name & position
477
478 cntLink[i] = n++;
479 typeMask |= knownCounters[i].type;
480
481 if (knownCounters[i].type == CNT_DB_INFO)
482 *pinfo++ = knownCounters[i].code;
483
484 goto found;
485 }
486 }
487 (Firebird::Arg::Gds(isc_random) << "Unknown name").raise(); //report name & position
488found: ;
489 }
490
491#ifdef WIN_NT
492#undef strtok_r
493#endif
494
495 // Force reset counters
496 memset(counters, 0, n * sizeof(ISC_INT64));
497
498 // Fill time counters
499 if (typeMask & CNT_TIMER)
500 {
501 SINT64 tr = fb_utils::query_performance_counter() * 1000 / fb_utils::query_performance_frequency();
502 SINT64 uTime, sTime;
503 fb_utils::get_process_times(uTime, sTime);

Callers

nothing calls this directly

Calls 10

GdsClass · 0.85
get_process_timesFunction · 0.85
get_parameterFunction · 0.85
beginMethod · 0.45
raiseMethod · 0.45
getInfoMethod · 0.45
getStateMethod · 0.45
stuffExceptionMethod · 0.45

Tested by

no test coverage detected