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

Function getCounts

src/jrd/inf.cpp:128–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126 typedef HalfStaticArray<UCHAR, BUFFER_SMALL> CountsBuffer;
127
128 ULONG getCounts(thread_db* tdbb, RuntimeStatistics::StatType type, CountsBuffer& buffer)
129 {
130 const Attachment* const attachment = tdbb->getAttachment();
131 const RuntimeStatistics& stats = attachment->att_stats;
132
133 UCHAR num_buffer[BUFFER_TINY];
134
135 buffer.clear();
136 FB_SIZE_T buffer_length = 0;
137
138 for (RuntimeStatistics::Iterator iter = stats.begin(); iter != stats.end(); ++iter)
139 {
140 const USHORT relation_id = (*iter).getRelationId();
141 const SINT64 n = (*iter).getCounter(type);
142
143 if (n)
144 {
145 const USHORT length = INF_convert(n, num_buffer);
146 const FB_SIZE_T new_buffer_length = buffer_length + length + sizeof(USHORT);
147 buffer.grow(new_buffer_length);
148 UCHAR* p = buffer.begin() + buffer_length;
149 STUFF_WORD(p, relation_id);
150 memcpy(p, num_buffer, length);
151 p += length;
152 buffer_length = new_buffer_length;
153 }
154 }
155
156 return buffer.getCount();
157 }
158}
159
160

Callers 1

INF_database_infoFunction · 0.85

Calls 9

INF_convertFunction · 0.85
getCounterMethod · 0.80
getAttachmentMethod · 0.45
clearMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
getRelationIdMethod · 0.45
growMethod · 0.45
getCountMethod · 0.45

Tested by

no test coverage detected