From 4b98181618f7dd4a7ed98b42720bdf8a009f9294 Mon Sep 17 00:00:00 2001 From: skidder Date: Sun, 4 Apr 2004 04:11:54 +0000 Subject: [PATCH] Update Trace API spec --- doc/README.performance_monitoring | 50 +++++++++++++++++++------------ 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/doc/README.performance_monitoring b/doc/README.performance_monitoring index c1fad2cd6c..b6358f7d16 100644 --- a/doc/README.performance_monitoring +++ b/doc/README.performance_monitoring @@ -1,5 +1,5 @@ Performance analysis with Firebird. - Document version 0.1 + Document version 0.2 Created by Nickolay Samofatov Performance monitoring framework is consisted of 2 parts: @@ -9,43 +9,55 @@ Performance monitoring framework is consisted of 2 parts: Trace API. - Trace API allows to plug a monitoring module into the engine and notify it -of processes happening there. List of analysis plugins is specified in -firebird.conf parameter TracePlugins. Each trace plugin receives notifications -on each database attached as a call of procedure having following signature: + Trace API allows to plug a monitoring module into the engine and notify it of +processes happening there. List of analysis plugins is specified in firebird.conf +parameter TracePlugins. Each trace plugin receives notifications on each database +opened by the engine as a call of procedure having following signature: -ISC_STATUS trace_attach(ISC_STATUS* status, TraceDatabase* db); +NTRACE_BOOLEAN trace_attach(const char* db_filename, const TracePlugin** plugin); -Conceptually db is the database trace interface, but it is implemented as a -structure of function pointers and void* object pointer. +Conceptually TracePlugin is the plugin trace interface. It is implemented as a +structure of function pointers and void* object pointer to be passed as first +argument for each function. Given this interface plugin may install hooks for particular events and receive -notifications on them. In fact, set of hooks is also implemented as a structure -with function pointers. +notifications for them. If plugin has interest in some kind of events for given +database it sets plugin pointer to a structure containing non-null hook function +pointers and returns NTRACE_TRUE value. Otherwise it should return NTRACE_FALSE. -See ntrace.h module for definitions of these structures and events supported. +One category of hooks receives the same parameters as corresponding Y-Valve +(public API) methods plus internal objects identifiers, generated PLANs for +statements and performance counters. One more hook receives performance +statistics for each procedure execution. + +Each hook function returns boolean value indicating success or failure. When hook +function fails engine collects error message from plugin in the same thread +context as hook was called, writes message to firebird.log and stops calling +hooks for this particular database and trace plugin. + +See jrd/ntrace.h module for definitions of structures and events supported. Default analysis module. Reference implementation of analysis plugin is centered around a concept of performance snapshot. Snapshot detail may vary, but in any case it contains -information on all activities performed by server during a given period of time, -possibly in aggregated form. All snapshots may be compared to allow quanititive -measurements of performance improvements due to various optimization activities -or changes in user applications and infrastucture. +information on all activities performed by server for database during a given +period of time, possibly in aggregated form. All snapshots may be compared to +allow quanititive measurements of performance improvements due to various +optimization activities or changes in user applications and infrastucture. Snapshot data is collected by trace module in raw form in a binary log file and then may be loaded into a stats database using ntrace utility. -Stored snapshots may contain data on usage of indices, statements executed, -their plans and performance counters, IO statistics and other performance data. +Stored snapshots may contain data on usage of indices, statements executed, their +plans and performance counters, IO statistics and other performance data. Level of detail for information collected is set up in analysis trace module configuration file on per-database basis. -Default analysis module does not have GUI and only provides a database with -data on server activities and some stored procedures to use and maintain it. +Default analysis module does not have GUI and only provides a database with data +on server activities and some stored procedures to use and maintain it. It is expected that third parties develop GUI tools, custom trace modules and statistics tools to statisfy rich client needs.