]]>
]]>

Implementation Details: Response Time Distribution

This feature reserve array for ranges. Maximum ranges number has for query_response_time_range_base=2. Array size calculated on compile time from QUERY_RESPONSE_TIME_STRING_POSITIVE_POWER_LENGTH, QUERY_RESPONSE_TIME_STRING_NEGATIVE_POWER_LENGTH, QUERY_RESPONSE_TIME_MINIMUM_BASE, and is 19 for negative power, and 23 for positive power (for second string width=7, microsecond string width=6, and range base=2).

utility

class utility
{
public:
  utility() : m_base(0);
public:
  uint      base()            const;
  uint      negative_count()  const;
  uint      positive_count()  const;
  uint      bound_count()     const;
  ulonglong max_dec_value()   const;
  ulonglong bound(uint index) const;
public:
  void setup(uint base);
};

Main class. Contain primary values calculated for current base. Recalculate after call setup(…) if need (if base different current).

string_collector

class string_collector
{
public:
  string_collector(utility& u);
  const char* string(uint index) const;
  void setup(utility& u)
};

Contains string representation of time intervals. Recalculate after call setup(…) if need (if base different current);

time_collector

class time_collector
{
public:
  time_collector(utility& u);
  ulong count(uint index);
  void flush();
  void collect(ulonglong time);
};

Contains collected time statistic.

collector

class collector
{
public:
  collector();
  void flush();
  int fill(THD* thd, TABLE_LIST *tables, COND *cond);
  void collect(ulonglong time);
};

Class concern all functionality in single entity.

Compile-time variables

Header file

sql/query_response_time.h

contain some settings of QUERY_RESPONSE_TIME.

Base range

minimum

This is minimum possible range base. In current time, it always equal 2, and don't defined in header file (but defined in source file).

QUERY_RESPONSE_TIME_MINIMUM_BASE

Warning: Please, never change this variable without change of POSITIVE_POWER_COUNT, NEGATIVE_POWER_COUNT variables.

maximum

This is maximum possible range base.

QUERY_RESPONSE_TIME_MAXIMUM_BASE

This value must be greater than QUERY_RESPONSE_TIME_MINIMUM_BASE always. You can change value while performed above constraints.

default

Default value of query_response_time_range_base variable.

QUERY_RESPONSE_TIME_DEFAULT_BASE

This value must be great or equal QUERY_RESPONSE_TIME_MINIMUM_BASE and less or equal QUERY_RESPONSE_TIME_MAXIMUM_BASE.

String width

Following settings control size of string in time column.

second

This value setup number of digit in second part.

QUERY_RESPONSE_TIME_STRING_POSITIVE_POWER_LENGTH
microsecond

This value setup number of digit in microsecond part.

QUERY_RESPONSE_TIME_STRING_NEGATIVE_POWER_LENGTH

In current time, it always equal 6, and don't defined in header file (but defined in source file).

String filler

Following settings control fillers for second and microsecond part of time column.

second
QUERY_RESPONSE_TIME_POSITIVE_POWER_FILLER

Current value is ” ” (space). Examples:

number time column
123
'    123'
1
'      1'
1324567
'1234567'
microsecond
QUERY_RESPONSE_TIME_NEGATIVE_POWER_FILLER

Current value is “0” (zero). Examples:

number time column
0.0123
'0.012300'
0.1
'0.100000'
0.132456
'0.132456'

Messages

Time overflow
QUERY_RESPONSE_TIME_TIME_OVERFLOW

Message for very long query (range from (base^maximum_power) to positive_infinity). Current value is “TOO LONG QUERY”

String overflow
QUERY_RESPONSE_TIME_STRING_OVERFLOW

This is internal message. Typical all string сorrespond string-width limitations: QUERY_RESPONSE_TIME_STRING_POSITIVE_POWER_LENGTH, QUERY_RESPONSE_TIME_STRING_NEGATIVE_POWER_LENGTH. Function

snprintf

control it. But if code has bug, and limitation don't correspond for some string, we look this message instead of buffer overflow. Current value is “TOO BIG STRING”

String length

Maximum string length:

QUERY_RESPONSE_TIME_STRING_LENGTH()

Calculates as max(length of QUERY_RESPONSE_TIME_STRING_OVERFLOW, QUERY_RESPONSE_TIME_TIME_OVERFLOW, QUERY_RESPONSE_TIME_STRING_POSITIVE_POWER_LENGTH + 1 + QUERY_RESPONSE_TIME_STRING_NEGATIVE_POWER_LENGTH). We plus one for last argument of max, because string contains ”.” delimeter.

 
percona-server/features/implementation_details/details_response_time_distribution.txt · Last modified: 2011/07/17 21:05 (external edit)
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Contact Us 24 Hours A Day
SupportContact us 24×7
Emergency? Contact us for help now!
Sales North America(888) 316-9775 or
(208) 473-2904
Sales
Europe
+44-208-133-0309 (UK)
0-800-051-8984 (UK)
0-800-181-0665 (GER)
Training(855) 55TRAIN or
(925) 271-5054

 

Share This
]]> ]]>