@@ -2080,12 +2080,21 @@ struct wait_for_commit
2080
2080
Structure to store the start time for a query
2081
2081
*/
2082
2082
2083
- typedef struct
2083
+ struct QUERY_START_TIME_INFO
2084
2084
{
2085
2085
my_time_t start_time;
2086
- ulong start_time_sec_part;
2086
+ ulong start_time_sec_part;
2087
2087
ulonglong start_utime, utime_after_lock;
2088
- } QUERY_START_TIME_INFO;
2088
+
2089
+ void backup_query_start_time (QUERY_START_TIME_INFO *backup)
2090
+ {
2091
+ *backup= *this;
2092
+ }
2093
+ void restore_query_start_time (QUERY_START_TIME_INFO *backup)
2094
+ {
2095
+ *this= *backup;
2096
+ }
2097
+ };
2089
2098
2090
2099
extern " C" void my_message_sql (uint error, const char *str, myf MyFlags);
2091
2100
@@ -2097,7 +2106,8 @@ extern "C" void my_message_sql(uint error, const char *str, myf MyFlags);
2097
2106
2098
2107
class THD :public Statement,
2099
2108
public MDL_context_owner,
2100
- public Open_tables_state
2109
+ public Open_tables_state,
2110
+ public QUERY_START_TIME_INFO
2101
2111
{
2102
2112
private:
2103
2113
inline bool is_stmt_prepare () const
@@ -2322,12 +2332,10 @@ class THD :public Statement,
2322
2332
uint32 file_id; // for LOAD DATA INFILE
2323
2333
/* remote (peer) port */
2324
2334
uint16 peer_port;
2325
- my_time_t start_time; // start_time and its sec_part
2326
- ulong start_time_sec_part; // are almost always used separately
2327
2335
my_hrtime_t user_time;
2328
2336
// track down slow pthread_create
2329
2337
ulonglong prior_thr_create_utime, thr_create_utime;
2330
- ulonglong start_utime, utime_after_lock, utime_after_query;
2338
+ ulonglong utime_after_query;
2331
2339
2332
2340
// Process indicator
2333
2341
struct {
@@ -3410,20 +3418,6 @@ class THD :public Statement,
3410
3418
MYSQL_SET_STATEMENT_LOCK_TIME (m_statement_psi,
3411
3419
(utime_after_lock - start_utime));
3412
3420
}
3413
- void get_time (QUERY_START_TIME_INFO *time_info)
3414
- {
3415
- time_info->start_time = start_time;
3416
- time_info->start_time_sec_part = start_time_sec_part;
3417
- time_info->start_utime = start_utime;
3418
- time_info->utime_after_lock = utime_after_lock;
3419
- }
3420
- void set_time (QUERY_START_TIME_INFO *time_info)
3421
- {
3422
- start_time= time_info->start_time ;
3423
- start_time_sec_part= time_info->start_time_sec_part ;
3424
- start_utime= time_info->start_utime ;
3425
- utime_after_lock= time_info->utime_after_lock ;
3426
- }
3427
3421
ulonglong current_utime () { return microsecond_interval_timer (); }
3428
3422
3429
3423
/* Tell SHOW PROCESSLIST to show time from this point */
0 commit comments