Skip to content

Commit 481669a

Browse files
committed
Misc const in ProfilerManager
1 parent c6a26fd commit 481669a

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

src/jrd/ProfilerManager.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ IExternalResultSet* ProfilerPackage::cancelSessionProcedure(ThrowStatusException
229229
return nullptr;
230230
}
231231

232-
const auto transaction = tdbb->getTransaction();
232+
const auto* transaction = tdbb->getTransaction();
233233
const auto profilerManager = attachment->getProfilerManager(tdbb);
234234

235235
profilerManager->cancelSession();
@@ -472,7 +472,7 @@ void ProfilerManager::prepareCursor(thread_db* tdbb, Request* request, const Sel
472472
if (!profileStatement)
473473
return;
474474

475-
auto cursorId = select->getCursorId();
475+
const auto cursorId = select->getCursorId();
476476

477477
if (!profileStatement->definedCursors.exist(cursorId))
478478
{
@@ -531,7 +531,7 @@ void ProfilerManager::onRequestFinish(Request* request, Stats& stats)
531531
{
532532
if (const auto profileRequestId = getRequest(request, 0))
533533
{
534-
const auto profileStatement = getStatement(request);
534+
const auto* profileStatement = getStatement(request);
535535
const auto timestamp = TimeZoneUtil::getCurrentTimeStamp(request->req_attachment->att_current_timezone);
536536

537537
LogLocalStatus status("Profiler onRequestFinish");
@@ -557,7 +557,7 @@ void ProfilerManager::finishSession(thread_db* tdbb, bool flushData)
557557
{
558558
if (currentSession)
559559
{
560-
const auto attachment = tdbb->getAttachment();
560+
const auto* attachment = tdbb->getAttachment();
561561
const auto timestamp = TimeZoneUtil::getCurrentTimeStamp(attachment->att_current_timezone);
562562
LogLocalStatus status("Profiler finish");
563563

@@ -658,6 +658,8 @@ ProfilerManager::Statement* ProfilerManager::getStatement(Request* request)
658658
type = "PROCEDURE";
659659
else if (statement->function)
660660
type = "FUNCTION";
661+
else
662+
fb_assert(false);
661663

662664
name = routine->getName();
663665
}
@@ -763,7 +765,7 @@ void ProfilerIpc::mutexBug(int osErrorCode, const char* text)
763765
void ProfilerIpc::internalSendAndReceive(thread_db* tdbb, Tag tag,
764766
const void* in, unsigned inSize, void* out, unsigned outSize)
765767
{
766-
const auto attachment = tdbb->getAttachment();
768+
const auto* attachment = tdbb->getAttachment();
767769

768770
{ // scope
769771
ThreadStatusGuard tempStatus(tdbb);
@@ -836,7 +838,7 @@ void ProfilerIpc::internalSendAndReceive(thread_db* tdbb, Tag tag,
836838
if (sharedMemory->eventPost(&header->serverEvent) != FB_SUCCESS)
837839
(Arg::Gds(isc_random) << "Cannot start remote profile session - attachment exited").raise();
838840

839-
const SLONG TIMEOUT = 500 * 1000; // 0.5 sec
841+
constexpr SLONG TIMEOUT = 500 * 1000; // 0.5 sec
840842
const int serverPID = header->serverEvent.event_pid;
841843

842844
while (true)

src/jrd/ProfilerManager.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ class ProfilerManager final : public Firebird::PerformanceStopWatch
128128
Request* request;
129129
ProfilerManager* profilerManager;
130130
const AccessPath* recordSource;
131-
SINT64 lastTicks;
132-
SINT64 lastAccumulatedOverhead;
131+
SINT64 lastTicks = 0;
132+
SINT64 lastAccumulatedOverhead = 0;
133133
Event event;
134134
};
135135

@@ -197,7 +197,7 @@ class ProfilerManager final : public Firebird::PerformanceStopWatch
197197
{
198198
if (const auto profileRequestId = getRequest(request, Firebird::IProfilerSession::FLAG_BEFORE_EVENTS))
199199
{
200-
const auto profileStatement = getStatement(request);
200+
const auto* profileStatement = getStatement(request);
201201
currentSession->pluginSession->beforePsqlLineColumn(profileStatement->id, profileRequestId, line, column);
202202
}
203203
}
@@ -206,7 +206,7 @@ class ProfilerManager final : public Firebird::PerformanceStopWatch
206206
{
207207
if (const auto profileRequestId = getRequest(request, Firebird::IProfilerSession::FLAG_AFTER_EVENTS))
208208
{
209-
const auto profileStatement = getStatement(request);
209+
const auto* profileStatement = getStatement(request);
210210
currentSession->pluginSession->afterPsqlLineColumn(profileStatement->id, profileRequestId,
211211
line, column, &stats);
212212
}
@@ -216,7 +216,7 @@ class ProfilerManager final : public Firebird::PerformanceStopWatch
216216
{
217217
if (const auto profileRequestId = getRequest(request, Firebird::IProfilerSession::FLAG_BEFORE_EVENTS))
218218
{
219-
const auto profileStatement = getStatement(request);
219+
const auto* profileStatement = getStatement(request);
220220

221221
if (const auto sequencePtr = profileStatement->recSourceSequence.get(recordSource->getRecSourceId()))
222222
{
@@ -230,7 +230,7 @@ class ProfilerManager final : public Firebird::PerformanceStopWatch
230230
{
231231
if (const auto profileRequestId = getRequest(request, Firebird::IProfilerSession::FLAG_AFTER_EVENTS))
232232
{
233-
const auto profileStatement = getStatement(request);
233+
const auto* profileStatement = getStatement(request);
234234

235235
if (const auto sequencePtr = profileStatement->recSourceSequence.get(recordSource->getRecSourceId()))
236236
{
@@ -244,7 +244,7 @@ class ProfilerManager final : public Firebird::PerformanceStopWatch
244244
{
245245
if (const auto profileRequestId = getRequest(request, Firebird::IProfilerSession::FLAG_BEFORE_EVENTS))
246246
{
247-
const auto profileStatement = getStatement(request);
247+
const auto* profileStatement = getStatement(request);
248248

249249
if (const auto sequencePtr = profileStatement->recSourceSequence.get(recordSource->getRecSourceId()))
250250
{
@@ -258,7 +258,7 @@ class ProfilerManager final : public Firebird::PerformanceStopWatch
258258
{
259259
if (const auto profileRequestId = getRequest(request, Firebird::IProfilerSession::FLAG_AFTER_EVENTS))
260260
{
261-
const auto profileStatement = getStatement(request);
261+
const auto* profileStatement = getStatement(request);
262262

263263
if (const auto sequencePtr = profileStatement->recSourceSequence.get(recordSource->getRecSourceId()))
264264
{

0 commit comments

Comments
 (0)