function performance_sort_summary in Performance Logging and Monitoring 7.2
Same name and namespace in other branches
- 6.2 performance.module \performance_sort_summary()
Helper function to sort data from the cache bin.
Parameters
$data array of data to sort:
$direction string asc or desc:
$field string name of field to sort:
Return value
sorted $data array
See also
2 calls to performance_sort_summary()
- drush_performance_summary in ./
performance.drush.inc - Summary page callback. Differs a little from the version in the module because drush_print_table() works differently.
- performance_view_summary in ./
performance.module - Summary page callback.
File
- ./
performance.module, line 643 - Logs detailed and/or summary page generation time and memory consumption for page requests. Copyright Khalid Baheyeldin 2008 of http://2bits.com
Code
function performance_sort_summary($data, $direction, $field) {
if (empty($data)) {
return $data;
}
switch ($direction) {
case 'asc':
$direction = SORT_ASC;
break;
case 'desc':
$direction = SORT_DESC;
break;
}
// Extract the column of data to be sorted.
$column = array();
foreach ($data as $key => $row) {
$column[$key] = $row[$field];
}
array_multisort($column, $direction, $data);
return $data;
}