mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 00:03:02 +01:00
Move public declarations from ntrace.h into firebird/Interface.h.
This commit is contained in:
parent
2635eb1440
commit
f9365d76af
@ -37,7 +37,64 @@
|
||||
#endif
|
||||
|
||||
struct dsc;
|
||||
struct PerformanceInfo;
|
||||
|
||||
namespace Firebird
|
||||
{
|
||||
|
||||
// Performance counters for individual table
|
||||
typedef int ntrace_relation_t;
|
||||
struct TraceCounts
|
||||
{
|
||||
// Per-table performance counters, must correspond to RuntimeStatistics::StatType
|
||||
// between RECORD_FIRST_ITEM and RECORD_LAST_ITEM
|
||||
enum RecordCounters
|
||||
{
|
||||
SEQ_READS = 0,
|
||||
IDX_READS,
|
||||
UPDATES,
|
||||
INSERTS,
|
||||
DELETES,
|
||||
BACKOUTS,
|
||||
PURGES,
|
||||
EXPUNGES,
|
||||
LOCKS,
|
||||
WAITS,
|
||||
CONFLICTS,
|
||||
BACKVERSION_READS,
|
||||
FRAGMENT_READS,
|
||||
RPT_READS,
|
||||
IMGC
|
||||
};
|
||||
|
||||
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_FIRST_ITEM
|
||||
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
|
||||
};
|
||||
|
||||
} // namespace Firebird
|
||||
|
||||
|
||||
#include "IdlFbInterfaces.h"
|
||||
|
||||
|
@ -28,8 +28,15 @@
|
||||
#include "../common/classes/init.h"
|
||||
#include "../common/classes/tree.h"
|
||||
|
||||
struct TraceCounts; // declared in ntrace.h
|
||||
struct PerformanceInfo; // declared in ntrace.h
|
||||
namespace Firebird
|
||||
{
|
||||
|
||||
// declared in firebird/Interface.h
|
||||
struct TraceCounts;
|
||||
struct PerformanceInfo;
|
||||
|
||||
} // namespace Firebird
|
||||
|
||||
|
||||
namespace Jrd {
|
||||
|
||||
@ -38,7 +45,7 @@ class Database;
|
||||
class thread_db;
|
||||
class jrd_rel;
|
||||
|
||||
typedef Firebird::HalfStaticArray<TraceCounts, 5> TraceCountsArray;
|
||||
typedef Firebird::HalfStaticArray<Firebird::TraceCounts, 5> TraceCountsArray;
|
||||
|
||||
// Runtime statistics class
|
||||
|
||||
@ -231,8 +238,8 @@ public:
|
||||
|
||||
// Calculate difference between counts stored in this object and current
|
||||
// counts of given request. Counts stored in object are destroyed.
|
||||
PerformanceInfo* computeDifference(Attachment* att, const RuntimeStatistics& new_stat,
|
||||
PerformanceInfo& dest, TraceCountsArray& temp);
|
||||
Firebird::PerformanceInfo* computeDifference(Attachment* att, const RuntimeStatistics& new_stat,
|
||||
Firebird::PerformanceInfo& dest, TraceCountsArray& temp);
|
||||
|
||||
// add difference between newStats and baseStats to our counters
|
||||
// newStats and baseStats must be "in-sync"
|
||||
|
@ -30,41 +30,6 @@
|
||||
#ifndef 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 char ntrace_byte_t;
|
||||
typedef ISC_UINT64 ntrace_counter_t;
|
||||
|
@ -84,7 +84,7 @@ class TraceTransactionImpl :
|
||||
public Firebird::AutoIface<Firebird::ITraceTransactionImpl<TraceTransactionImpl, Firebird::CheckStatusWrapper> >
|
||||
{
|
||||
public:
|
||||
TraceTransactionImpl(const jrd_tra* tran, PerformanceInfo* perf = NULL, ISC_INT64 prevID = 0) :
|
||||
TraceTransactionImpl(const jrd_tra* tran, Firebird::PerformanceInfo* perf = NULL, ISC_INT64 prevID = 0) :
|
||||
m_tran(tran),
|
||||
m_perf(perf),
|
||||
m_prevID(prevID)
|
||||
@ -95,13 +95,13 @@ public:
|
||||
FB_BOOLEAN getReadOnly();
|
||||
int getWait();
|
||||
unsigned getIsolation();
|
||||
PerformanceInfo* getPerf() { return m_perf; }
|
||||
Firebird::PerformanceInfo* getPerf() { return m_perf; }
|
||||
ISC_INT64 getInitialID();
|
||||
ISC_INT64 getPreviousID() { return m_prevID; }
|
||||
|
||||
private:
|
||||
const jrd_tra* const m_tran;
|
||||
PerformanceInfo* const m_perf;
|
||||
Firebird::PerformanceInfo* const m_perf;
|
||||
const ISC_INT64 m_prevID;
|
||||
};
|
||||
|
||||
@ -146,18 +146,18 @@ private:
|
||||
class TraceBLRStatementImpl : public BLRPrinter<TraceBLRStatementImpl>
|
||||
{
|
||||
public:
|
||||
TraceBLRStatementImpl(const jrd_req* stmt, PerformanceInfo* perf) :
|
||||
TraceBLRStatementImpl(const jrd_req* stmt, Firebird::PerformanceInfo* perf) :
|
||||
BLRPrinter(stmt->getStatement()->blr.begin(), stmt->getStatement()->blr.getCount()),
|
||||
m_stmt(stmt),
|
||||
m_perf(perf)
|
||||
{}
|
||||
|
||||
ISC_INT64 getStmtID() { return m_stmt->getRequestId(); }
|
||||
PerformanceInfo* getPerf() { return m_perf; }
|
||||
Firebird::PerformanceInfo* getPerf() { return m_perf; }
|
||||
|
||||
private:
|
||||
const jrd_req* const m_stmt;
|
||||
PerformanceInfo* const m_perf;
|
||||
Firebird::PerformanceInfo* const m_perf;
|
||||
};
|
||||
|
||||
|
||||
@ -169,7 +169,7 @@ public:
|
||||
{}
|
||||
|
||||
ISC_INT64 getStmtID() { return 0; }
|
||||
PerformanceInfo* getPerf() { return NULL; }
|
||||
Firebird::PerformanceInfo* getPerf() { return NULL; }
|
||||
};
|
||||
|
||||
|
||||
@ -177,7 +177,7 @@ class TraceSQLStatementImpl :
|
||||
public Firebird::AutoIface<Firebird::ITraceSQLStatementImpl<TraceSQLStatementImpl, Firebird::CheckStatusWrapper> >
|
||||
{
|
||||
public:
|
||||
TraceSQLStatementImpl(const dsql_req* stmt, PerformanceInfo* perf) :
|
||||
TraceSQLStatementImpl(const dsql_req* stmt, Firebird::PerformanceInfo* perf) :
|
||||
m_stmt(stmt),
|
||||
m_perf(perf),
|
||||
m_planExplained(false),
|
||||
@ -186,7 +186,7 @@ public:
|
||||
|
||||
// TraceSQLStatement implementation
|
||||
ISC_INT64 getStmtID();
|
||||
PerformanceInfo* getPerf();
|
||||
Firebird::PerformanceInfo* getPerf();
|
||||
Firebird::ITraceParams* getInputs();
|
||||
const char* getText();
|
||||
const char* getPlan();
|
||||
@ -224,7 +224,7 @@ private:
|
||||
void fillPlan(bool explained);
|
||||
|
||||
const dsql_req* const m_stmt;
|
||||
PerformanceInfo* const m_perf;
|
||||
Firebird::PerformanceInfo* const m_perf;
|
||||
Firebird::string m_plan;
|
||||
bool m_planExplained;
|
||||
DSQLParamsImpl m_inputs;
|
||||
@ -242,7 +242,7 @@ public:
|
||||
|
||||
// TraceSQLStatement implementation
|
||||
ISC_INT64 getStmtID() { return 0; }
|
||||
PerformanceInfo* getPerf() { return NULL; }
|
||||
Firebird::PerformanceInfo* getPerf() { return NULL; }
|
||||
Firebird::ITraceParams* getInputs() { return NULL; }
|
||||
const char* getText() { return m_text.c_str(); }
|
||||
const char* getPlan() { return ""; }
|
||||
@ -402,7 +402,7 @@ class TraceProcedureImpl :
|
||||
public Firebird::AutoIface<Firebird::ITraceProcedureImpl<TraceProcedureImpl, Firebird::CheckStatusWrapper> >
|
||||
{
|
||||
public:
|
||||
TraceProcedureImpl(jrd_req* request, PerformanceInfo* perf) :
|
||||
TraceProcedureImpl(jrd_req* request, Firebird::PerformanceInfo* perf) :
|
||||
m_request(request),
|
||||
m_perf(perf),
|
||||
m_inputs(*getDefaultMemoryPool(), request->req_proc_caller, request->req_proc_inputs),
|
||||
@ -417,11 +417,11 @@ public:
|
||||
}
|
||||
|
||||
Firebird::ITraceParams* getInputs() { return m_inputs; }
|
||||
PerformanceInfo* getPerf() { return m_perf; };
|
||||
Firebird::PerformanceInfo* getPerf() { return m_perf; };
|
||||
|
||||
private:
|
||||
jrd_req* const m_request;
|
||||
PerformanceInfo* const m_perf;
|
||||
Firebird::PerformanceInfo* const m_perf;
|
||||
TraceDscFromValues m_inputs;
|
||||
Firebird::string m_name;
|
||||
};
|
||||
@ -431,7 +431,7 @@ class TraceFunctionImpl :
|
||||
public Firebird::AutoIface<Firebird::ITraceFunctionImpl<TraceFunctionImpl, Firebird::CheckStatusWrapper> >
|
||||
{
|
||||
public:
|
||||
TraceFunctionImpl(jrd_req* request, Firebird::ITraceParams* inputs, PerformanceInfo* perf, const dsc* value) :
|
||||
TraceFunctionImpl(jrd_req* request, Firebird::ITraceParams* inputs, Firebird::PerformanceInfo* perf, const dsc* value) :
|
||||
m_request(request),
|
||||
m_perf(perf),
|
||||
m_inputs(inputs),
|
||||
@ -447,11 +447,11 @@ public:
|
||||
|
||||
Firebird::ITraceParams* getInputs() { return m_inputs; }
|
||||
Firebird::ITraceParams* getResult() { return m_value; }
|
||||
PerformanceInfo* getPerf() { return m_perf; };
|
||||
Firebird::PerformanceInfo* getPerf() { return m_perf; };
|
||||
|
||||
private:
|
||||
jrd_req* const m_request;
|
||||
PerformanceInfo* const m_perf;
|
||||
Firebird::PerformanceInfo* const m_perf;
|
||||
Firebird::ITraceParams* m_inputs;
|
||||
TraceDscFromDsc m_value;
|
||||
Firebird::string m_name;
|
||||
@ -462,7 +462,7 @@ class TraceTriggerImpl :
|
||||
public Firebird::AutoIface<Firebird::ITraceTriggerImpl<TraceTriggerImpl, Firebird::CheckStatusWrapper> >
|
||||
{
|
||||
public:
|
||||
TraceTriggerImpl(const jrd_req* trig, SSHORT which, PerformanceInfo* perf) :
|
||||
TraceTriggerImpl(const jrd_req* trig, SSHORT which, Firebird::PerformanceInfo* perf) :
|
||||
m_trig(trig),
|
||||
m_which(which),
|
||||
m_perf(perf)
|
||||
@ -473,12 +473,12 @@ public:
|
||||
const char* getRelationName();
|
||||
int getAction() { return m_trig->req_trigger_action; }
|
||||
int getWhich() { return m_which; }
|
||||
PerformanceInfo* getPerf() { return m_perf; }
|
||||
Firebird::PerformanceInfo* getPerf() { return m_perf; }
|
||||
|
||||
private:
|
||||
const jrd_req* const m_trig;
|
||||
const SSHORT m_which;
|
||||
PerformanceInfo* const m_perf;
|
||||
Firebird::PerformanceInfo* const m_perf;
|
||||
};
|
||||
|
||||
|
||||
@ -516,10 +516,10 @@ public:
|
||||
TraceRuntimeStats(Attachment* att, RuntimeStatistics* baseline, RuntimeStatistics* stats,
|
||||
SINT64 clock, SINT64 records_fetched);
|
||||
|
||||
PerformanceInfo* getPerf() { return &m_info; }
|
||||
Firebird::PerformanceInfo* getPerf() { return &m_info; }
|
||||
|
||||
private:
|
||||
PerformanceInfo m_info;
|
||||
Firebird::PerformanceInfo m_info;
|
||||
TraceCountsArray m_counts;
|
||||
static SINT64 m_dummy_counts[RuntimeStatistics::TOTAL_ITEMS]; // Zero-initialized array with zero counts
|
||||
};
|
||||
@ -623,7 +623,7 @@ public:
|
||||
m_next = Ods::getNT(header);
|
||||
}
|
||||
|
||||
void setPerf(PerformanceInfo* perf)
|
||||
void setPerf(Firebird::PerformanceInfo* perf)
|
||||
{
|
||||
m_perf = perf;
|
||||
}
|
||||
@ -632,14 +632,14 @@ public:
|
||||
ISC_INT64 getOST() { return m_ost; };
|
||||
ISC_INT64 getOAT() { return m_oat; };
|
||||
ISC_INT64 getNext() { return m_next; };
|
||||
PerformanceInfo* getPerf() { return m_perf; };
|
||||
Firebird::PerformanceInfo* getPerf() { return m_perf; };
|
||||
|
||||
private:
|
||||
TraNumber m_oit;
|
||||
TraNumber m_ost;
|
||||
TraNumber m_oat;
|
||||
TraNumber m_next;
|
||||
PerformanceInfo* m_perf;
|
||||
Firebird::PerformanceInfo* m_perf;
|
||||
};
|
||||
|
||||
} // namespace Jrd
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include "firebird/impl/consts_pub.h"
|
||||
#include "codetext.h"
|
||||
#include "../../common/isc_f_proto.h"
|
||||
#include "../../jrd/RuntimeStatistics.h"
|
||||
#include "../../common/dsc.h"
|
||||
#include "../../common/utils_proto.h"
|
||||
#include "../../common/UtilSvc.h"
|
||||
@ -485,25 +484,25 @@ void TracePluginImpl::appendGlobalCounts(const PerformanceInfo* info)
|
||||
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
record.append(temp);
|
||||
@ -542,7 +541,7 @@ void TracePluginImpl::appendTableCounts(const PerformanceInfo *info)
|
||||
{
|
||||
record.append(trc->trc_relation_name);
|
||||
record.append(max_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)
|
||||
{
|
||||
|
@ -171,8 +171,8 @@ private:
|
||||
GdsCodesArray include_codes;
|
||||
GdsCodesArray exclude_codes;
|
||||
|
||||
void appendGlobalCounts(const PerformanceInfo* info);
|
||||
void appendTableCounts(const PerformanceInfo* info);
|
||||
void appendGlobalCounts(const Firebird::PerformanceInfo* info);
|
||||
void appendTableCounts(const Firebird::PerformanceInfo* info);
|
||||
void appendParams(Firebird::ITraceParams* params);
|
||||
void appendServiceQueryParams(size_t send_item_length, const ntrace_byte_t* send_items,
|
||||
size_t recv_item_length, const ntrace_byte_t* recv_items);
|
||||
|
Loading…
Reference in New Issue
Block a user