You are here

function perfmon_test_db_update in Performance monitor 7

Same name and namespace in other branches
  1. 8 perfmon.module \perfmon_test_db_update()

Test db update operations.

1 string reference to 'perfmon_test_db_update'
_perfmon_performance_tests in ./perfmon.inc
Core Perfmon checks.

File

./perfmon.inc, line 298
Stand-alone perfmon test system.

Code

function perfmon_test_db_update() {
  $exectime = 0;
  $count = 1000;
  db_truncate('perfmon_test')
    ->execute();
  perfmon_test_db_prepare('test_db_update', $count);
  $exectime = microtime(TRUE);
  for ($i = 0; $i < $count; $i++) {
    $query = db_update('perfmon_test');
    $query
      ->fields(array(
      'data' => 'bbbbbbbbbbbbbbbbbbbbb',
    ));
    $query
      ->condition('id', $i);
    $query
      ->execute();
  }
  $exectime = microtime(TRUE) - $exectime;
  return array(
    'result' => round(1 / ($exectime / $count), 0),
    'value' => '0',
  );
}