You are here

function migrate_memory_stop in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 migrate.module \migrate_memory_stop()

Stop the memory counter with the specified name.

Parameters

name: The name of the memory measurement.

Return value

A memory array. The array contains the number of times the memory has been started and stopped (count) and the accumulated memory difference value in bytes.

1 call to migrate_memory_stop()
migrate_instrument_stop in ./migrate.module
Stop measuring both memory and time consumption over a section of code.

File

./migrate.module, line 532
API and drush commands to support migration of data from external sources into a Drupal installation.

Code

function migrate_memory_stop($name) {
  global $_migrate_memory;
  if (isset($_migrate_memory[$name])) {
    if (isset($_migrate_memory[$name]['start'])) {
      $stop = memory_get_usage();
      $diff = $stop - $_migrate_memory[$name]['start'];
      if (isset($_migrate_memory[$name]['bytes'])) {
        $_migrate_memory[$name]['bytes'] += $diff;
      }
      else {
        $_migrate_memory[$name]['bytes'] = $diff;
      }
      unset($_migrate_memory[$name]['start']);
    }
    return $_migrate_memory[$name];
  }
}