8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 18:03:04 +01:00

Move public declarations from ntrace.h into firebird/Interface.h.

This commit is contained in:
hvlad 2020-06-20 14:34:07 +03:00
parent 1390335c40
commit da83f29fd1
4 changed files with 61 additions and 44 deletions

View File

@ -37,7 +37,59 @@
#endif #endif
struct dsc; struct dsc;
struct PerformanceInfo;
// Performance counters for individual table
typedef int ntrace_relation_t;
struct TraceCounts
{
// Per-table performance counters, must correspond to RuntimeStatistics::StatType
// starting from RECORD_SEQ_READS.
// Used with trc_counters.
enum RecordCounters
{
SEQ_READS,
IDX_READS,
UPDATES,
INSERTS,
DELETES,
BACKOUTS,
PURGES,
EXPUNGES,
LOCKS,
WAITS,
CONFLICTS,
BACKVERSION_READS,
FRAGMENT_READS,
RPT_READS
};
ntrace_relation_t trc_relation_id; // Relation ID
const char* trc_relation_name; // Relation name
const ISC_INT64* trc_counters; // Pointer to allow easy addition of new counters
};
// Performance statistics for operation
struct PerformanceInfo
{
// IO performance counters, must correspond to RuntimeStatistics::StatType
// between PAGE_FETCHES and (not including) RECORD_SEQ_READS.
// Used with pin_counters.
enum PageCounters
{
FETCHES = 0,
READS,
MARKS,
WRITES
};
ISC_INT64 pin_time; // Total operation time in milliseconds
ISC_INT64* pin_counters; // Pointer to allow easy addition of new counters
size_t pin_count; // Number of relations involved in analysis
struct TraceCounts* pin_tables; // Pointer to array with table stats
ISC_INT64 pin_records_fetched; // records fetched from statement/procedure
};
#include "IdlFbInterfaces.h" #include "IdlFbInterfaces.h"

View File

@ -28,8 +28,9 @@
#include "../common/classes/init.h" #include "../common/classes/init.h"
#include "../common/classes/tree.h" #include "../common/classes/tree.h"
struct TraceCounts; // declared in ntrace.h // declared in firebird/Interface.h
struct PerformanceInfo; // declared in ntrace.h struct TraceCounts;
struct PerformanceInfo;
namespace Jrd { namespace Jrd {

View File

@ -30,41 +30,6 @@
#ifndef FIREBIRD_NTRACE_H #ifndef FIREBIRD_NTRACE_H
#define FIREBIRD_NTRACE_H #define FIREBIRD_NTRACE_H
#include "firebird/Interface.h"
const int DBB_max_rel_count = 8; // must be the same as DBB_max_count from jrd.h
// Performance counters for entire database
enum {
DBB_fetches_count = 0,
DBB_reads_count,
DBB_marks_count,
DBB_writes_count,
DBB_max_dbb_count
};
// Performance counters for individual table
typedef int ntrace_relation_t;
struct TraceCounts
{
ntrace_relation_t trc_relation_id; // Relation ID
const char* trc_relation_name; // Relation name
const ISC_INT64* trc_counters; // Pointer to allow easy addition of new counters
};
// Performance statistics for operation
struct PerformanceInfo
{
ISC_INT64 pin_time; // Total operation time in milliseconds
ISC_INT64* pin_counters; // Pointer to allow easy addition of new counters
size_t pin_count; // Number of relations involved in analysis
struct TraceCounts* pin_tables; // Pointer to array with table stats
ISC_INT64 pin_records_fetched; // records fetched from statement/procedure
};
typedef unsigned int ntrace_result_t; typedef unsigned int ntrace_result_t;
typedef unsigned char ntrace_byte_t; typedef unsigned char ntrace_byte_t;
typedef ISC_UINT64 ntrace_counter_t; typedef ISC_UINT64 ntrace_counter_t;

View File

@ -35,7 +35,6 @@
#include "consts_pub.h" #include "consts_pub.h"
#include "codetext.h" #include "codetext.h"
#include "../../common/isc_f_proto.h" #include "../../common/isc_f_proto.h"
#include "../../jrd/RuntimeStatistics.h"
#include "../../common/dsc.h" #include "../../common/dsc.h"
#include "../../common/utils_proto.h" #include "../../common/utils_proto.h"
#include "../../common/UtilSvc.h" #include "../../common/UtilSvc.h"
@ -486,25 +485,25 @@ void TracePluginImpl::appendGlobalCounts(const PerformanceInfo* info)
ntrace_counter_t cnt; ntrace_counter_t cnt;
if ((cnt = info->pin_counters[RuntimeStatistics::PAGE_READS]) != 0) if ((cnt = info->pin_counters[PerformanceInfo::READS]) != 0)
{ {
temp.printf(", %" QUADFORMAT"d read(s)", cnt); temp.printf(", %" QUADFORMAT"d read(s)", cnt);
record.append(temp); record.append(temp);
} }
if ((cnt = info->pin_counters[RuntimeStatistics::PAGE_WRITES]) != 0) if ((cnt = info->pin_counters[PerformanceInfo::WRITES]) != 0)
{ {
temp.printf(", %" QUADFORMAT"d write(s)", cnt); temp.printf(", %" QUADFORMAT"d write(s)", cnt);
record.append(temp); record.append(temp);
} }
if ((cnt = info->pin_counters[RuntimeStatistics::PAGE_FETCHES]) != 0) if ((cnt = info->pin_counters[PerformanceInfo::FETCHES]) != 0)
{ {
temp.printf(", %" QUADFORMAT"d fetch(es)", cnt); temp.printf(", %" QUADFORMAT"d fetch(es)", cnt);
record.append(temp); record.append(temp);
} }
if ((cnt = info->pin_counters[RuntimeStatistics::PAGE_MARKS]) != 0) if ((cnt = info->pin_counters[PerformanceInfo::MARKS]) != 0)
{ {
temp.printf(", %" QUADFORMAT"d mark(s)", cnt); temp.printf(", %" QUADFORMAT"d mark(s)", cnt);
record.append(temp); record.append(temp);
@ -530,7 +529,7 @@ void TracePluginImpl::appendTableCounts(const PerformanceInfo *info)
{ {
record.append(trc->trc_relation_name); record.append(trc->trc_relation_name);
record.append(MAX_SQL_IDENTIFIER_LEN - fb_strlen(trc->trc_relation_name), ' '); record.append(MAX_SQL_IDENTIFIER_LEN - fb_strlen(trc->trc_relation_name), ' ');
for (int j = 0; j < DBB_max_rel_count; j++) for (int j = 0; j <= TraceCounts::EXPUNGES; j++)
{ {
if (trc->trc_counters[j] == 0) if (trc->trc_counters[j] == 0)
{ {