2016-06-01 05:04:31 +00:00
|
|
|
<?php
|
|
|
|
class dbm {
|
|
|
|
public static function processlist() {
|
|
|
|
$r = q("SHOW PROCESSLIST");
|
|
|
|
$s = array();
|
|
|
|
|
|
|
|
$states = array();
|
|
|
|
foreach ($r AS $process) {
|
|
|
|
$state = trim($process["State"]);
|
|
|
|
if (!in_array($state, array("", "init", "statistics")))
|
|
|
|
++$states[$state];
|
|
|
|
}
|
|
|
|
// query end
|
|
|
|
// Sending data
|
|
|
|
// updating
|
|
|
|
|
|
|
|
$statelist = "";
|
2016-06-03 21:10:23 +00:00
|
|
|
$processes = 0;
|
2016-06-01 05:04:31 +00:00
|
|
|
foreach ($states AS $state => $usage) {
|
|
|
|
if ($statelist != "")
|
|
|
|
$statelist .= ", ";
|
|
|
|
$statelist .= $state.": ".$usage;
|
2016-06-03 21:10:23 +00:00
|
|
|
++$processes;
|
2016-06-01 05:04:31 +00:00
|
|
|
}
|
2016-06-03 21:10:23 +00:00
|
|
|
return(array("list" => $statelist, "amount" => $processes));
|
2016-06-01 05:04:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|