mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 16:03:02 +01:00
Refactored RuntimeStatistics internals. Added more record-level performance counters.
This commit is contained in:
parent
06572bf0fb
commit
a8b1dba646
@ -577,6 +577,11 @@
|
||||
const USHORT f_mon_rec_backouts = 7;
|
||||
const USHORT f_mon_rec_purges = 8;
|
||||
const USHORT f_mon_rec_expunges = 9;
|
||||
const USHORT f_mon_rec_locks = 10;
|
||||
const USHORT f_mon_rec_waits = 11;
|
||||
const USHORT f_mon_rec_conflicts = 12;
|
||||
const USHORT f_mon_rec_ver_reads = 13;
|
||||
const USHORT f_mon_rec_frg_reads = 14;
|
||||
|
||||
|
||||
// Relation 40 (MON$CONTEXT_VARIABLES)
|
||||
|
@ -1094,7 +1094,12 @@ void Monitoring::putStatistics(SnapshotData::DumpRecord& record, const RuntimeSt
|
||||
record.storeInteger(f_mon_rec_backouts, statistics.getValue(RuntimeStatistics::RECORD_BACKOUTS));
|
||||
record.storeInteger(f_mon_rec_purges, statistics.getValue(RuntimeStatistics::RECORD_PURGES));
|
||||
record.storeInteger(f_mon_rec_expunges, statistics.getValue(RuntimeStatistics::RECORD_EXPUNGES));
|
||||
writer.putRecord(record);
|
||||
record.storeInteger(f_mon_rec_locks, statistics.getValue(RuntimeStatistics::RECORD_LOCKS));
|
||||
record.storeInteger(f_mon_rec_waits, statistics.getValue(RuntimeStatistics::RECORD_WAITS));
|
||||
record.storeInteger(f_mon_rec_conflicts, statistics.getValue(RuntimeStatistics::RECORD_CONFLICTS));
|
||||
record.storeInteger(f_mon_rec_ver_reads, statistics.getValue(RuntimeStatistics::RECORD_VERSION_READS));
|
||||
record.storeInteger(f_mon_rec_frg_reads, statistics.getValue(RuntimeStatistics::RECORD_FRAGMENT_READS));
|
||||
writer.putRecord(record);
|
||||
}
|
||||
|
||||
void Monitoring::putContextVars(SnapshotData::DumpRecord& record, const StringMap& variables,
|
||||
|
@ -33,153 +33,18 @@ namespace Jrd {
|
||||
|
||||
GlobalPtr<RuntimeStatistics> RuntimeStatistics::dummy;
|
||||
|
||||
#ifdef REL_COUNTS_TREE
|
||||
|
||||
void RuntimeStatistics::bumpRelValue(const RelStatType index, SLONG relation_id)
|
||||
{
|
||||
fb_assert(index >= 0);
|
||||
++relChgNumber;
|
||||
|
||||
RelCounters::Accessor accessor(&rel_counts);
|
||||
if (accessor.locate(relation_id))
|
||||
accessor.current().rlc_counter[index]++;
|
||||
else
|
||||
{
|
||||
RelationCounts counts;
|
||||
memset(&counts, 0, sizeof(counts));
|
||||
counts.rlc_relation_id = relation_id;
|
||||
counts.rlc_counter[index]++;
|
||||
rel_counts.add(counts);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RuntimeStatistics::addRelCounts(const RelCounters& other, bool add)
|
||||
{
|
||||
RelCounters::Accessor first(&rel_counts);
|
||||
RelCounters::ConstAccessor second(&other);
|
||||
|
||||
if (second.getFirst())
|
||||
{
|
||||
do
|
||||
{
|
||||
const RelationCounts& src = second.current();
|
||||
|
||||
if (!first.locate(src.rlc_relation_id))
|
||||
{
|
||||
RelationCounts counts;
|
||||
memset(&counts, 0, sizeof(counts));
|
||||
counts.rlc_relation_id = src.rlc_relation_id;
|
||||
first.add(counts);
|
||||
|
||||
first.locate(src.rlc_relation_id);
|
||||
}
|
||||
|
||||
RelationCounts& dst = first.current();
|
||||
fb_assert(src.rlc_relation_id == dst.rlc_relation_id);
|
||||
|
||||
if (add)
|
||||
{
|
||||
for (int index = 0; index < FB_NELEM(src.rlc_counter); index++)
|
||||
dst.rlc_counter[index] += src.rlc_counter[index];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int index = 0; index < FB_NELEM(src.rlc_counter); index++)
|
||||
dst.rlc_counter[index] -= src.rlc_counter[index];
|
||||
}
|
||||
} while (second.getNext());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PerformanceInfo* RuntimeStatistics::computeDifference(
|
||||
Database* dbb, const RuntimeStatistics& new_stat, PerformanceInfo& dest, TraceCountsArray& temp)
|
||||
{
|
||||
// NOTE: we do not initialize dest.pin_time. This must be done by the caller
|
||||
|
||||
// Calculate database-level statistics
|
||||
for (int i = 0; i < TOTAL_ITEMS; i++)
|
||||
values[i] = new_stat.values[i] - values[i];
|
||||
|
||||
dest.pin_counters = values;
|
||||
|
||||
// Calculate relation-level statistics
|
||||
temp.clear();
|
||||
|
||||
RelCounters::ConstAccessor new_acc(&new_stat.rel_counts);
|
||||
|
||||
if (new_acc.getFirst())
|
||||
{
|
||||
// This loop assumes that base array is smaller than new one
|
||||
RelCounters::Accessor base_acc(&rel_counts);
|
||||
bool base_found = base_acc.getFirst();
|
||||
|
||||
do
|
||||
{
|
||||
const RelationCounts* counts = &new_acc.current();
|
||||
if (base_found && base_acc.current().rlc_relation_id == counts->rlc_relation_id)
|
||||
{
|
||||
RelationCounts* base_counts = &base_acc.current();
|
||||
bool all_zeros = true;
|
||||
for (int i = 0; i < DBB_max_rel_count; i++)
|
||||
{
|
||||
if ((base_counts->rlc_counter[i] = counts->rlc_counter[i] - base_counts->rlc_counter[i]))
|
||||
all_zeros = false;
|
||||
}
|
||||
|
||||
// Point TraceCounts to counts array from baseline object
|
||||
if (!all_zeros)
|
||||
{
|
||||
jrd_rel* relation = counts->rlc_relation_id < dbb->dbb_relations->count() ?
|
||||
(*dbb->dbb_relations)[counts->rlc_relation_id] : NULL;
|
||||
TraceCounts traceCounts;
|
||||
traceCounts.trc_relation_id = counts->rlc_relation_id;
|
||||
traceCounts.trc_counters = base_counts->rlc_counter;
|
||||
traceCounts.trc_relation_name = relation ? relation->rel_name.c_str() : NULL;
|
||||
temp.add(traceCounts);
|
||||
}
|
||||
|
||||
base_found = base_acc.getNext();
|
||||
}
|
||||
else
|
||||
{
|
||||
jrd_rel* relation = counts->rlc_relation_id < dbb->dbb_relations->count() ?
|
||||
(*dbb->dbb_relations)[counts->rlc_relation_id] : NULL;
|
||||
|
||||
// Point TraceCounts to counts array from object with updated counters
|
||||
TraceCounts traceCounts;
|
||||
traceCounts.trc_relation_id = counts->rlc_relation_id;
|
||||
traceCounts.trc_counters = counts->rlc_counter;
|
||||
traceCounts.trc_relation_name = relation ? relation->rel_name.c_str() : NULL;
|
||||
temp.add(traceCounts);
|
||||
}
|
||||
} while (new_acc.getNext());
|
||||
}
|
||||
|
||||
dest.pin_count = temp.getCount();
|
||||
dest.pin_tables = temp.begin();
|
||||
|
||||
return &dest;
|
||||
}
|
||||
|
||||
#else // REL_COUNTS_TREE
|
||||
|
||||
|
||||
void RuntimeStatistics::bumpRelValue(const RelStatType index, SLONG relation_id)
|
||||
void RuntimeStatistics::bumpRelValue(const StatType index, SLONG relation_id, SINT64 delta)
|
||||
{
|
||||
fb_assert(index >= 0);
|
||||
++relChgNumber;
|
||||
|
||||
FB_SIZE_T pos;
|
||||
if (rel_counts.find(relation_id, pos))
|
||||
rel_counts[pos].rlc_counter[index]++;
|
||||
rel_counts[pos].bumpCounter(index, delta);
|
||||
else
|
||||
{
|
||||
RelationCounts counts;
|
||||
memset(&counts, 0, sizeof(counts));
|
||||
counts.rlc_relation_id = relation_id;
|
||||
counts.rlc_counter[index]++;
|
||||
RelationCounts counts(relation_id);
|
||||
counts.bumpCounter(index, delta);
|
||||
rel_counts.add(counts);
|
||||
}
|
||||
}
|
||||
@ -193,37 +58,26 @@ void RuntimeStatistics::addRelCounts(const RelCounters& other, bool add)
|
||||
const RelCounters::const_iterator end(other.end());
|
||||
|
||||
FB_SIZE_T pos;
|
||||
rel_counts.find(src->rlc_relation_id, pos);
|
||||
rel_counts.find(src->getRelationId(), pos);
|
||||
for (; src != end; ++src)
|
||||
{
|
||||
const FB_SIZE_T cnt = rel_counts.getCount();
|
||||
|
||||
while (pos < cnt && rel_counts[pos].rlc_relation_id < src->rlc_relation_id)
|
||||
while (pos < cnt && rel_counts[pos].getRelationId() < src->getRelationId())
|
||||
pos++;
|
||||
|
||||
if (pos >= cnt || rel_counts[pos].rlc_relation_id > src->rlc_relation_id)
|
||||
if (pos >= cnt || rel_counts[pos].getRelationId() > src->getRelationId())
|
||||
{
|
||||
RelationCounts counts;
|
||||
memset(&counts, 0, sizeof(counts));
|
||||
counts.rlc_relation_id = src->rlc_relation_id;
|
||||
RelationCounts counts(src->getRelationId());
|
||||
rel_counts.insert(pos, counts);
|
||||
}
|
||||
|
||||
fb_assert(pos >= 0 && pos < rel_counts.getCount());
|
||||
|
||||
RelationCounts* dst = &(rel_counts[pos]);
|
||||
fb_assert(dst->rlc_relation_id == src->rlc_relation_id);
|
||||
|
||||
if (add)
|
||||
{
|
||||
for (int index = 0; index < FB_NELEM(src->rlc_counter); index++)
|
||||
dst->rlc_counter[index] += src->rlc_counter[index];
|
||||
}
|
||||
rel_counts[pos] += *src;
|
||||
else
|
||||
{
|
||||
for (int index = 0; index < FB_NELEM(src->rlc_counter); index++)
|
||||
dst->rlc_counter[index] -= src->rlc_counter[index];
|
||||
}
|
||||
rel_counts[pos] -= *src;
|
||||
}
|
||||
}
|
||||
|
||||
@ -251,23 +105,18 @@ PerformanceInfo* RuntimeStatistics::computeDifference(Attachment* att,
|
||||
const RelCounters::const_iterator end = new_stat.rel_counts.end();
|
||||
for (; new_cnts != end; ++new_cnts)
|
||||
{
|
||||
if (base_found && base_cnts->rlc_relation_id == new_cnts->rlc_relation_id)
|
||||
if (base_found && base_cnts->getRelationId() == new_cnts->getRelationId())
|
||||
{
|
||||
bool all_zeros = true;
|
||||
for (int i = 0; i < DBB_max_rel_count; i++)
|
||||
{
|
||||
if ((base_cnts->rlc_counter[i] = new_cnts->rlc_counter[i] - base_cnts->rlc_counter[i]))
|
||||
all_zeros = false;
|
||||
}
|
||||
|
||||
// Point TraceCounts to counts array from baseline object
|
||||
if (!all_zeros)
|
||||
if (base_cnts->setToDiff(*new_cnts))
|
||||
{
|
||||
jrd_rel* relation = new_cnts->rlc_relation_id < static_cast<SLONG>(att->att_relations->count()) ?
|
||||
(*att->att_relations)[new_cnts->rlc_relation_id] : NULL;
|
||||
jrd_rel* const relation =
|
||||
new_cnts->getRelationId() < static_cast<SLONG>(att->att_relations->count()) ?
|
||||
(*att->att_relations)[new_cnts->getRelationId()] : NULL;
|
||||
|
||||
TraceCounts traceCounts;
|
||||
traceCounts.trc_relation_id = new_cnts->rlc_relation_id;
|
||||
traceCounts.trc_counters = base_cnts->rlc_counter;
|
||||
traceCounts.trc_relation_id = new_cnts->getRelationId();
|
||||
traceCounts.trc_counters = base_cnts->getCounterVector();
|
||||
traceCounts.trc_relation_name = relation ? relation->rel_name.c_str() : NULL;
|
||||
temp.add(traceCounts);
|
||||
}
|
||||
@ -277,13 +126,14 @@ PerformanceInfo* RuntimeStatistics::computeDifference(Attachment* att,
|
||||
}
|
||||
else
|
||||
{
|
||||
jrd_rel* relation = new_cnts->rlc_relation_id < static_cast<SLONG>(att->att_relations->count()) ?
|
||||
(*att->att_relations)[new_cnts->rlc_relation_id] : NULL;
|
||||
jrd_rel* const relation =
|
||||
new_cnts->getRelationId() < static_cast<SLONG>(att->att_relations->count()) ?
|
||||
(*att->att_relations)[new_cnts->getRelationId()] : NULL;
|
||||
|
||||
// Point TraceCounts to counts array from object with updated counters
|
||||
TraceCounts traceCounts;
|
||||
traceCounts.trc_relation_id = new_cnts->rlc_relation_id;
|
||||
traceCounts.trc_counters = new_cnts->rlc_counter;
|
||||
traceCounts.trc_relation_id = new_cnts->getRelationId();
|
||||
traceCounts.trc_counters = new_cnts->getCounterVector();
|
||||
traceCounts.trc_relation_name = relation ? relation->rel_name.c_str() : NULL;
|
||||
temp.add(traceCounts);
|
||||
}
|
||||
@ -294,6 +144,15 @@ PerformanceInfo* RuntimeStatistics::computeDifference(Attachment* att,
|
||||
|
||||
return &dest;
|
||||
}
|
||||
#endif // REL_COUNTS_TREE
|
||||
|
||||
RuntimeStatistics::Accumulator::Accumulator(thread_db* tdbb, const jrd_rel* relation, StatType type)
|
||||
: m_tdbb(tdbb), m_type(type), m_id(relation->rel_id), m_counter(0)
|
||||
{}
|
||||
|
||||
RuntimeStatistics::Accumulator::~Accumulator()
|
||||
{
|
||||
if (m_counter)
|
||||
m_tdbb->bumpRelStats(m_type, m_id, m_counter);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -33,58 +33,10 @@ struct PerformanceInfo; // declared in ntrace.h
|
||||
|
||||
namespace Jrd {
|
||||
|
||||
// hvlad: what to use for relation's counters - tree or sorted array ?
|
||||
// #define REL_COUNTS_TREE
|
||||
// #define REL_COUNTS_PTR
|
||||
|
||||
class Attachment;
|
||||
class Database;
|
||||
|
||||
//
|
||||
// Database record counters.
|
||||
//
|
||||
enum RelStatType
|
||||
{
|
||||
DBB_read_seq_count = 0,
|
||||
DBB_read_idx_count,
|
||||
DBB_update_count,
|
||||
DBB_insert_count,
|
||||
DBB_delete_count,
|
||||
DBB_backout_count,
|
||||
DBB_purge_count,
|
||||
DBB_expunge_count,
|
||||
DBB_lock_count,
|
||||
DBB_max_count
|
||||
};
|
||||
|
||||
// Performance counters for individual table
|
||||
struct RelationCounts
|
||||
{
|
||||
SLONG rlc_relation_id; // Relation ID
|
||||
SINT64 rlc_counter[DBB_max_count];
|
||||
|
||||
#ifdef REL_COUNTS_PTR
|
||||
inline static const SLONG* generate(const RelationCounts* item)
|
||||
{
|
||||
return &item->rlc_relation_id;
|
||||
}
|
||||
#else
|
||||
inline static const SLONG& generate(const RelationCounts& item)
|
||||
{
|
||||
return item.rlc_relation_id;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
#if defined(REL_COUNTS_TREE)
|
||||
typedef Firebird::BePlusTree<RelationCounts, SLONG, Firebird::MemoryPool, RelationCounts> RelCounters;
|
||||
#elif defined(REL_COUNTS_PTR)
|
||||
typedef Firebird::PointersArray<RelationCounts, Firebird::EmptyStorage<RelationCounts>,
|
||||
SLONG, RelationCounts> RelCounters;
|
||||
#else
|
||||
typedef Firebird::SortedArray<RelationCounts, Firebird::EmptyStorage<RelationCounts>,
|
||||
SLONG, RelationCounts> RelCounters;
|
||||
#endif
|
||||
class thread_db;
|
||||
class jrd_rel;
|
||||
|
||||
typedef Firebird::HalfStaticArray<TraceCounts, 5> TraceCountsArray;
|
||||
|
||||
@ -108,6 +60,10 @@ public:
|
||||
RECORD_PURGES,
|
||||
RECORD_EXPUNGES,
|
||||
RECORD_LOCKS,
|
||||
RECORD_WAITS,
|
||||
RECORD_CONFLICTS,
|
||||
RECORD_VERSION_READS,
|
||||
RECORD_FRAGMENT_READS,
|
||||
SORTS,
|
||||
SORT_GETS,
|
||||
SORT_PUTS,
|
||||
@ -116,6 +72,91 @@ public:
|
||||
TOTAL_ITEMS // last
|
||||
};
|
||||
|
||||
// Performance counters for individual table
|
||||
|
||||
class RelationCounts
|
||||
{
|
||||
static const size_t REL_BASE_OFFSET = RECORD_SEQ_READS;
|
||||
|
||||
public:
|
||||
static const size_t REL_TOTAL_ITEMS = RECORD_FRAGMENT_READS - REL_BASE_OFFSET + 1;
|
||||
|
||||
explicit RelationCounts(SLONG relation_id)
|
||||
: rlc_relation_id(relation_id)
|
||||
{
|
||||
memset(rlc_counter, 0, sizeof(rlc_counter));
|
||||
}
|
||||
|
||||
SLONG getRelationId() const
|
||||
{
|
||||
return rlc_relation_id;
|
||||
}
|
||||
|
||||
const SINT64* getCounterVector() const
|
||||
{
|
||||
return rlc_counter;
|
||||
}
|
||||
|
||||
SINT64 getCounter(size_t index) const
|
||||
{
|
||||
fb_assert(index >= REL_BASE_OFFSET && index < REL_BASE_OFFSET + REL_TOTAL_ITEMS);
|
||||
return rlc_counter[index - REL_BASE_OFFSET];
|
||||
}
|
||||
|
||||
void bumpCounter(size_t index, SINT64 delta = 1)
|
||||
{
|
||||
fb_assert(index >= REL_BASE_OFFSET && index < REL_BASE_OFFSET + REL_TOTAL_ITEMS);
|
||||
rlc_counter[index - REL_BASE_OFFSET] += delta;
|
||||
}
|
||||
|
||||
bool setToDiff(const RelationCounts& other)
|
||||
{
|
||||
fb_assert(rlc_relation_id == other.rlc_relation_id);
|
||||
|
||||
bool ret = false;
|
||||
|
||||
for (size_t i = 0; i < REL_TOTAL_ITEMS; i++)
|
||||
{
|
||||
if ( (rlc_counter[i] = other.rlc_counter[i] - rlc_counter[i]) )
|
||||
ret = true;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
RelationCounts& operator+=(const RelationCounts& other)
|
||||
{
|
||||
fb_assert(rlc_relation_id == other.rlc_relation_id);
|
||||
|
||||
for (size_t i = 0; i < REL_TOTAL_ITEMS; i++)
|
||||
rlc_counter[i] += other.rlc_counter[i];
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
RelationCounts& operator-=(const RelationCounts& other)
|
||||
{
|
||||
fb_assert(rlc_relation_id == other.rlc_relation_id);
|
||||
|
||||
for (size_t i = 0; i < REL_TOTAL_ITEMS; i++)
|
||||
rlc_counter[i] -= other.rlc_counter[i];
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline static const SLONG& generate(const RelationCounts& item)
|
||||
{
|
||||
return item.rlc_relation_id;
|
||||
}
|
||||
|
||||
private:
|
||||
SLONG rlc_relation_id;
|
||||
SINT64 rlc_counter[REL_TOTAL_ITEMS];
|
||||
};
|
||||
|
||||
typedef Firebird::SortedArray<RelationCounts, Firebird::EmptyStorage<RelationCounts>,
|
||||
SLONG, RelationCounts> RelCounters;
|
||||
|
||||
RuntimeStatistics()
|
||||
: Firebird::AutoStorage(), rel_counts(getPool())
|
||||
{
|
||||
@ -163,28 +204,25 @@ public:
|
||||
return values[index];
|
||||
}
|
||||
|
||||
void bumpValue(const StatType index)
|
||||
void bumpValue(const StatType index, SINT64 delta = 1)
|
||||
{
|
||||
++values[index];
|
||||
values[index] += delta;
|
||||
++allChgNumber;
|
||||
}
|
||||
|
||||
SINT64 getRelValue(const RelStatType index, SLONG relation_id) const
|
||||
SINT64 getRelValue(const StatType index, SLONG relation_id) const
|
||||
{
|
||||
FB_SIZE_T pos;
|
||||
return rel_counts.find(relation_id, pos) ? rel_counts[pos].rlc_counter[index] : 0;
|
||||
return rel_counts.find(relation_id, pos) ? rel_counts[pos].getCounter(index) : 0;
|
||||
}
|
||||
|
||||
void bumpRelValue(const RelStatType index, SLONG relation_id);
|
||||
void bumpRelValue(const StatType index, SLONG relation_id, SINT64 delta = 1);
|
||||
|
||||
// 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);
|
||||
|
||||
// bool operator==(const RuntimeStatistics& other) const;
|
||||
// bool operator!=(const RuntimeStatistics& other) const;
|
||||
|
||||
// add difference between newStats and baseStats to our counters
|
||||
// newStats and baseStats must be "in-sync"
|
||||
void adjust(const RuntimeStatistics& baseStats, const RuntimeStatistics& newStats)
|
||||
@ -193,9 +231,7 @@ public:
|
||||
{
|
||||
allChgNumber++;
|
||||
for (size_t i = 0; i < TOTAL_ITEMS; ++i)
|
||||
{
|
||||
values[i] += newStats.values[i] - baseStats.values[i];
|
||||
}
|
||||
|
||||
if (baseStats.relChgNumber != newStats.relChgNumber)
|
||||
{
|
||||
@ -276,6 +312,24 @@ public:
|
||||
return Iterator(rel_counts.end());
|
||||
}
|
||||
|
||||
class Accumulator
|
||||
{
|
||||
public:
|
||||
Accumulator(thread_db* tdbb, const jrd_rel* relation, StatType type);
|
||||
~Accumulator();
|
||||
|
||||
void operator++()
|
||||
{
|
||||
m_counter++;
|
||||
}
|
||||
|
||||
private:
|
||||
thread_db* m_tdbb;
|
||||
StatType m_type;
|
||||
SLONG m_id;
|
||||
SINT64 m_counter;
|
||||
};
|
||||
|
||||
private:
|
||||
void addRelCounts(const RelCounters& other, bool add);
|
||||
|
||||
|
@ -344,42 +344,42 @@ void INF_database_info(thread_db* tdbb,
|
||||
break;
|
||||
|
||||
case isc_info_read_seq_count:
|
||||
length = get_counts(tdbb, DBB_read_seq_count, counts_buffer);
|
||||
length = get_counts(tdbb, RuntimeStatistics::RECORD_SEQ_READS, counts_buffer);
|
||||
buffer = counts_buffer.begin();
|
||||
break;
|
||||
|
||||
case isc_info_read_idx_count:
|
||||
length = get_counts(tdbb, DBB_read_idx_count, counts_buffer);
|
||||
length = get_counts(tdbb, RuntimeStatistics::RECORD_IDX_READS, counts_buffer);
|
||||
buffer = counts_buffer.begin();
|
||||
break;
|
||||
|
||||
case isc_info_update_count:
|
||||
length = get_counts(tdbb, DBB_update_count, counts_buffer);
|
||||
length = get_counts(tdbb, RuntimeStatistics::RECORD_UPDATES, counts_buffer);
|
||||
buffer = counts_buffer.begin();
|
||||
break;
|
||||
|
||||
case isc_info_insert_count:
|
||||
length = get_counts(tdbb, DBB_insert_count, counts_buffer);
|
||||
length = get_counts(tdbb, RuntimeStatistics::RECORD_INSERTS, counts_buffer);
|
||||
buffer = counts_buffer.begin();
|
||||
break;
|
||||
|
||||
case isc_info_delete_count:
|
||||
length = get_counts(tdbb, DBB_delete_count, counts_buffer);
|
||||
length = get_counts(tdbb, RuntimeStatistics::RECORD_DELETES, counts_buffer);
|
||||
buffer = counts_buffer.begin();
|
||||
break;
|
||||
|
||||
case isc_info_backout_count:
|
||||
length = get_counts(tdbb, DBB_backout_count, counts_buffer);
|
||||
length = get_counts(tdbb, RuntimeStatistics::RECORD_BACKOUTS, counts_buffer);
|
||||
buffer = counts_buffer.begin();
|
||||
break;
|
||||
|
||||
case isc_info_purge_count:
|
||||
length = get_counts(tdbb, DBB_purge_count, counts_buffer);
|
||||
length = get_counts(tdbb, RuntimeStatistics::RECORD_PURGES, counts_buffer);
|
||||
buffer = counts_buffer.begin();
|
||||
break;
|
||||
|
||||
case isc_info_expunge_count:
|
||||
length = get_counts(tdbb, DBB_expunge_count, counts_buffer);
|
||||
length = get_counts(tdbb, RuntimeStatistics::RECORD_EXPUNGES, counts_buffer);
|
||||
buffer = counts_buffer.begin();
|
||||
break;
|
||||
|
||||
@ -1202,8 +1202,8 @@ static USHORT get_counts(thread_db* tdbb, USHORT count_id, CountsBuffer& buffer)
|
||||
|
||||
for (RuntimeStatistics::Iterator iter = stats.begin(); iter != stats.end(); ++iter)
|
||||
{
|
||||
const USHORT relation_id = (*iter).rlc_relation_id;
|
||||
const SINT64 n = (*iter).rlc_counter[count_id];
|
||||
const USHORT relation_id = (*iter).getRelationId();
|
||||
const SINT64 n = (*iter).getCounter(count_id);
|
||||
|
||||
if (n)
|
||||
{
|
||||
|
@ -483,19 +483,21 @@ public:
|
||||
|
||||
SSHORT getCharSet() const;
|
||||
|
||||
void bumpStats(const RuntimeStatistics::StatType index)
|
||||
void bumpStats(const RuntimeStatistics::StatType index, SINT64 delta = 1)
|
||||
{
|
||||
reqStat->bumpValue(index);
|
||||
traStat->bumpValue(index);
|
||||
attStat->bumpValue(index);
|
||||
dbbStat->bumpValue(index);
|
||||
reqStat->bumpValue(index, delta);
|
||||
traStat->bumpValue(index, delta);
|
||||
attStat->bumpValue(index, delta);
|
||||
dbbStat->bumpValue(index, delta);
|
||||
}
|
||||
|
||||
void bumpRelStats(const RelStatType index, SLONG relation_id)
|
||||
void bumpRelStats(const RuntimeStatistics::StatType index, SLONG relation_id, SINT64 delta = 1)
|
||||
{
|
||||
reqStat->bumpRelValue(index, relation_id);
|
||||
traStat->bumpRelValue(index, relation_id);
|
||||
attStat->bumpRelValue(index, relation_id);
|
||||
bumpStats(index, delta);
|
||||
|
||||
reqStat->bumpRelValue(index, relation_id, delta);
|
||||
traStat->bumpRelValue(index, relation_id, delta);
|
||||
attStat->bumpRelValue(index, relation_id, delta);
|
||||
//dbbStat->bumpRelValue(index, relation_id);
|
||||
}
|
||||
|
||||
|
@ -296,6 +296,7 @@ NAME("MON$DATABASE", nam_mon_database)
|
||||
NAME("MON$DATABASE_NAME", nam_mon_db_name)
|
||||
NAME("MON$EXPLAINED_PLAN", nam_mon_expl_plan)
|
||||
NAME("MON$FORCED_WRITES", nam_mon_forced_writes)
|
||||
NAME("MON$FRAGMENT_READS", nam_mon_fragment_reads)
|
||||
NAME("MON$GARBAGE_COLLECTION", nam_mon_gc)
|
||||
NAME("MON$IO_STATS", nam_mon_io_stats)
|
||||
NAME("MON$ISOLATION_MODE", nam_mon_iso_mode)
|
||||
@ -325,14 +326,17 @@ NAME("MON$PAGE_READS", nam_mon_page_reads)
|
||||
NAME("MON$PAGE_WRITES", nam_mon_page_writes)
|
||||
NAME("MON$PAGES", nam_mon_pages)
|
||||
NAME("MON$RECORD_BACKOUTS", nam_mon_rec_backouts)
|
||||
NAME("MON$RECORD_CONFLICTS", nam_mon_rec_conflicts)
|
||||
NAME("MON$RECORD_DELETES", nam_mon_rec_deletes)
|
||||
NAME("MON$RECORD_EXPUNGES", nam_mon_rec_expunges)
|
||||
NAME("MON$RECORD_IDX_READS", nam_mon_rec_idx_reads)
|
||||
NAME("MON$RECORD_INSERTS", nam_mon_rec_inserts)
|
||||
NAME("MON$RECORD_LOCKS", nam_mon_rec_locks)
|
||||
NAME("MON$RECORD_PURGES", nam_mon_rec_purges)
|
||||
NAME("MON$RECORD_SEQ_READS", nam_mon_rec_seq_reads)
|
||||
NAME("MON$RECORD_STATS", nam_mon_rec_stats)
|
||||
NAME("MON$RECORD_UPDATES", nam_mon_rec_updates)
|
||||
NAME("MON$RECORD_WAITS", nam_mon_rec_waits)
|
||||
NAME("MON$REMOTE_ADDRESS", nam_mon_remote_addr)
|
||||
NAME("MON$REMOTE_HOST", nam_mon_remote_host)
|
||||
NAME("MON$REMOTE_OS_USER", nam_mon_remote_os_user)
|
||||
@ -361,6 +365,7 @@ NAME("MON$TRANSACTION_ID", nam_mon_tra_id)
|
||||
NAME("MON$USER", nam_mon_user)
|
||||
NAME("MON$VARIABLE_NAME", nam_mon_var_name)
|
||||
NAME("MON$VARIABLE_VALUE", nam_mon_var_value)
|
||||
NAME("MON$VERSION_READS", nam_mon_version_reads)
|
||||
|
||||
NAME("SEC$USERS", nam_sec_users)
|
||||
NAME("SEC$USER_ATTRIBUTES", nam_sec_user_attributes)
|
||||
|
@ -576,6 +576,11 @@ RELATION(nam_mon_rec_stats, rel_mon_rec_stats, ODS_11_1, rel_virtual)
|
||||
FIELD(f_mon_rec_backouts, nam_mon_rec_backouts, fld_counter, 0, ODS_11_1)
|
||||
FIELD(f_mon_rec_purges, nam_mon_rec_purges, fld_counter, 0, ODS_11_1)
|
||||
FIELD(f_mon_rec_expunges, nam_mon_rec_expunges, fld_counter, 0, ODS_11_1)
|
||||
FIELD(f_mon_rec_locks, nam_mon_rec_locks, fld_counter, 0, ODS_12_0)
|
||||
FIELD(f_mon_rec_waits, nam_mon_rec_waits, fld_counter, 0, ODS_12_0)
|
||||
FIELD(f_mon_rec_conflicts, nam_mon_rec_conflicts, fld_counter, 0, ODS_12_0)
|
||||
FIELD(f_mon_rec_ver_reads, nam_mon_version_reads, fld_counter, 0, ODS_12_0)
|
||||
FIELD(f_mon_rec_frg_reads, nam_mon_fragment_reads, fld_counter, 0, ODS_12_0)
|
||||
END_RELATION
|
||||
|
||||
// Relation 40 (MON$CONTEXT_VARIABLES)
|
||||
|
481
src/jrd/vio.cpp
481
src/jrd/vio.cpp
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user