diff options
| author | Christian Schneider | 2026-03-23 14:49:23 +0100 |
|---|---|---|
| committer | Christian Schneider | 2026-03-23 14:49:23 +0100 |
| commit | 7211d0baed1e77db85ab0c21062ddeeecac7caaf (patch) | |
| tree | 72d4568d4eb19270e17c7b8d8db2897a0ca92cd0 /it_dbi.class | |
| parent | 53cea921e33a9bfc7f98e873c5f791f74edfaa78 (diff) | |
| download | itools-7211d0baed1e77db85ab0c21062ddeeecac7caaf.tar.gz itools-7211d0baed1e77db85ab0c21062ddeeecac7caaf.tar.bz2 itools-7211d0baed1e77db85ab0c21062ddeeecac7caaf.zip | |
Switch ULTRATIME and some other runtime measurements to hrtime()
Diffstat (limited to 'it_dbi.class')
| -rw-r--r-- | it_dbi.class | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/it_dbi.class b/it_dbi.class index a3d2c31..24c271e 100644 --- a/it_dbi.class +++ b/it_dbi.class @@ -559,7 +559,7 @@ function clear() function query($query, $p = array()) { $p += $this->_p; - $start = gettimeofday(true); + $start = hrtime(true); if (($writing = !it::match('^(EXPLAIN|SELECT|SHOW)', $query, array('utf8' => false)))) { @@ -594,11 +594,11 @@ function query($query, $p = array()) if ($writing && $this->_p['throttle_writes']) { - it::log('debug', 'dbi-throttle', round(1000000 * (gettimeofday(true) - $start) * $this->_p['throttle_writes'])); - usleep(round(1000000 * (gettimeofday(true) - $start) * $this->_p['throttle_writes'])); + it::log('debug', 'dbi-throttle', round((hrtime(true) - $start) / 1000 * $this->_p['throttle_writes'])); + usleep(round((hrtime(true) - $start) / 1000 * $this->_p['throttle_writes'])); } - $msec = round(1000 * (gettimeofday(true) - $start)); + $msec = round((hrtime(true) - $start) / 1_000_000); $slow = $msec >= 2000; if ($GLOBALS['debug_sqllog'] || $GLOBALS['debug_sqltrace'] || $slow) { |