You are here

public static function Tester::doBatchGenerateSitemap in Simple XML sitemap 4.x

Same name and namespace in other branches
  1. 8.3 tests/scripts/performance_test.php \Tester::doBatchGenerateSitemap()

Parameters

bool $count_queries:

$context:

Throws

\Drupal\Component\Plugin\Exception\PluginException

File

tests/scripts/performance_test.php, line 123

Class

Tester

Code

public static function doBatchGenerateSitemap($count_queries = FALSE, &$context) {
  if ($count_queries) {
    $query_logger = Database::startLog('simple_sitemap');
  }

  // Passes a special object in to $context that outputs every time
  // $context['message'] is set.
  BatchTrait::doBatchGenerateSitemap($context);
  if ($count_queries) {
    $context['message'] = "Query count: " . count($query_logger
      ->get('simple_sitemap'));
  }
  else {
    $peak_mem = format_size(memory_get_peak_usage(TRUE));
    $mem = format_size(memory_get_usage(TRUE));
    $context['message'] = "Memory: {$peak_mem}, non-peak mem: {$mem}";
  }
}