function perfmon_test_db_update in Performance monitor 8
Same name and namespace in other branches
- 7 perfmon.inc \perfmon_test_db_update()
Test db update operations.
1 string reference to 'perfmon_test_db_update'
- _perfmon_performance_tests in ./
perfmon.module - Core Perfmon checks.
File
- ./
perfmon.module, line 286 - Stand-alone perfmon test system.
Code
function perfmon_test_db_update() {
$executeTime = 0;
$count = 1000;
\Drupal::database()
->truncate('perfmon_test')
->execute();
perfmon_test_db_prepare('test_db_update', $count);
$executeTime = microtime(TRUE);
for ($i = 0; $i < $count; $i++) {
\Drupal::database()
->update('perfmon_test')
->fields([
'data' => 'bbbbbbbbbbbbbbbbbbbbb',
])
->condition('id', $i)
->execute();
}
$executeTime = microtime(TRUE) - $executeTime;
return array(
'result' => round(1 / ($executeTime / $count), 0),
'value' => '0',
);
}