Commit 4e421687 authored by Sergei Petrunia's avatar Sergei Petrunia

Merge pull request #112 from openquery/MDEV-8981

MDEV-8981: Analyze stmt - cycles can overflow
parents b80cc31a 0b8144a4
......@@ -47,6 +47,14 @@ class Exec_time_tracker
ulonglong count;
ulonglong cycles;
ulonglong last_start;
void cycles_stop_tracking()
{
ulonglong end= my_timer_cycles();
cycles += end - last_start;
if (unlikely(end < last_start))
cycles += ULONGLONG_MAX;
}
public:
Exec_time_tracker() : count(0), cycles(0) {}
......@@ -59,7 +67,7 @@ class Exec_time_tracker
void stop_tracking()
{
count++;
cycles += my_timer_cycles()- last_start;
cycles_stop_tracking();
}
// interface for getting the time
......@@ -93,7 +101,7 @@ class Time_and_counter_tracker: public Exec_time_tracker
*/
void stop_tracking()
{
cycles += my_timer_cycles()- last_start;
cycles_stop_tracking();
}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment