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

Method startSession

src/jrd/ProfilerManager.cpp:417–483  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

415}
416
417SINT64 ProfilerManager::startSession(thread_db* tdbb, Nullable<SLONG> flushInterval,
418 const PathName& pluginName, const string& description, const string& options)
419{
420 if (flushInterval.isAssigned())
421 checkFlushInterval(flushInterval.value);
422
423 AutoSetRestore<bool> pauseProfiler(&paused, true);
424
425 const auto attachment = tdbb->getAttachment();
426 ThrowLocalStatus status;
427
428 const auto timestamp = TimeZoneUtil::getCurrentTimeStamp(attachment->att_current_timezone);
429
430 if (currentSession)
431 {
432 currentSession->pluginSession->finish(&status, timestamp);
433 currentSession = nullptr;
434 }
435
436 auto pluginPtr = activePlugins.get(pluginName);
437
438 AutoPlugin<IProfilerPlugin> plugin;
439
440 if (pluginPtr)
441 {
442 (*pluginPtr)->addRef();
443 plugin.reset(pluginPtr->get());
444 }
445 else
446 {
447 GetPlugins<IProfilerPlugin> plugins(IPluginManager::TYPE_PROFILER, pluginName.nullStr());
448
449 if (!plugins.hasData())
450 {
451 string msg;
452 msg.printf("Profiler plugin %s is not found", pluginName.c_str());
453 (Arg::Gds(isc_random) << msg).raise();
454 }
455
456 plugin.reset(plugins.plugin());
457 plugin->addRef();
458
459 plugin->init(&status, attachment->getInterface(), (FB_UINT64) fb_utils::query_performance_frequency());
460
461 plugin->addRef();
462 activePlugins.put(pluginName)->reset(plugin.get());
463 }
464
465 AutoDispose<IProfilerSession> pluginSession = plugin->startSession(&status,
466 description.c_str(),
467 options.c_str(),
468 timestamp);
469
470 auto& pool = *tdbb->getAttachment()->att_pool;
471
472 currentSession.reset(FB_NEW_POOL(pool) ProfilerManager::Session(pool));
473 currentSession->pluginSession = std::move(pluginSession);
474 currentSession->plugin = std::move(plugin);

Callers 2

startSessionFunctionMethod · 0.45
processCommandMethod · 0.45

Calls 15

GdsClass · 0.85
isAssignedMethod · 0.80
pluginMethod · 0.80
SessionClass · 0.70
moveFunction · 0.50
getAttachmentMethod · 0.45
finishMethod · 0.45
getMethod · 0.45
addRefMethod · 0.45
resetMethod · 0.45
nullStrMethod · 0.45

Tested by

no test coverage detected