Commit 542f54ca authored by Leigh B. Stoller's avatar Leigh B. Stoller

Add last_activity field to experiment_stats to make searching/indexing

easier.

Also add a daily_stats table that will record, you guessed it, the
daily stats, which will be a mucg faster wayt to see what is going on
and even generate some graphs.
parent b94bedc4
...@@ -525,11 +525,13 @@ sub Create($$$$) ...@@ -525,11 +525,13 @@ sub Create($$$$)
# #
if (! DBQueryWarn("insert into experiment_stats ". if (! DBQueryWarn("insert into experiment_stats ".
"(eid, pid, creator, creator_idx, gid, created, ". "(eid, pid, creator, creator_idx, gid, created, ".
" batch, exptidx, rsrcidx, pid_idx, gid_idx, eid_uuid) ". " batch, exptidx, rsrcidx, pid_idx, gid_idx, eid_uuid, ".
" last_activity) ".
"values('$eid', '$pid', '$creator_uid', '$creator_idx',". "values('$eid', '$pid', '$creator_uid', '$creator_idx',".
" '$gid', FROM_UNIXTIME('$now'), ". " '$gid', FROM_UNIXTIME('$now'), ".
" $batchmode, $exptidx, $rsrcidx, ". " $batchmode, $exptidx, $rsrcidx, ".
" $pid_idx, $gid_idx, '$uuid')")) { " $pid_idx, $gid_idx, '$uuid', ".
" FROM_UNIXTIME('$now'))")) {
DBQueryWarn("delete from experiments where pid='$pid' and eid='$eid'"); DBQueryWarn("delete from experiments where pid='$pid' and eid='$eid'");
DBQueryWarn("delete from experiment_resources where idx=$rsrcidx"); DBQueryWarn("delete from experiment_resources where idx=$rsrcidx");
DBQueryWarn("unlock tables"); DBQueryWarn("unlock tables");
...@@ -2172,6 +2174,7 @@ sub PostSwap($$$$) ...@@ -2172,6 +2174,7 @@ sub PostSwap($$$$)
DBQueryWarn("update experiment_stats ". DBQueryWarn("update experiment_stats ".
"set ${tmp}_count=${tmp}_count+1, ". "set ${tmp}_count=${tmp}_count+1, ".
" ${tmp}_last=now(), ". " ${tmp}_last=now(), ".
" last_activity=${tmp}_last, ".
" swapin_duration=swapin_duration+${duration}, ". " swapin_duration=swapin_duration+${duration}, ".
" swap_exitcode=0, ". " swap_exitcode=0, ".
" last_error=NULL ". " last_error=NULL ".
......
...@@ -233,6 +233,26 @@ CREATE TABLE `current_reloads` ( ...@@ -233,6 +233,26 @@ CREATE TABLE `current_reloads` (
PRIMARY KEY (`node_id`) PRIMARY KEY (`node_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `daily_stats`
--
DROP TABLE IF EXISTS `daily_stats`;
CREATE TABLE `daily_stats` (
`theday` date default NULL,
`exptstart_count` int(11) unsigned default '0',
`exptpreload_count` int(11) unsigned default '0',
`exptswapin_count` int(11) unsigned default '0',
`exptswapout_count` int(11) unsigned default '0',
`exptswapmod_count` int(11) unsigned default '0',
`allexpt_duration` int(11) unsigned default '0',
`allexpt_vnodes` int(11) unsigned default '0',
`allexpt_vnode_duration` int(11) unsigned default '0',
`allexpt_pnodes` int(11) unsigned default '0',
`allexpt_pnode_duration` int(11) unsigned default '0',
PRIMARY KEY (`theday`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-- --
-- Table structure for table `datapository_databases` -- Table structure for table `datapository_databases`
-- --
...@@ -643,6 +663,7 @@ CREATE TABLE `experiment_stats` ( ...@@ -643,6 +663,7 @@ CREATE TABLE `experiment_stats` (
`gid_idx` mediumint(8) unsigned NOT NULL default '0', `gid_idx` mediumint(8) unsigned NOT NULL default '0',
`created` datetime default NULL, `created` datetime default NULL,
`destroyed` datetime default NULL, `destroyed` datetime default NULL,
`last_activity` datetime default NULL,
`swapin_count` smallint(5) unsigned default '0', `swapin_count` smallint(5) unsigned default '0',
`swapin_last` datetime default NULL, `swapin_last` datetime default NULL,
`swapout_count` smallint(5) unsigned default '0', `swapout_count` smallint(5) unsigned default '0',
......
...@@ -4395,3 +4395,28 @@ last_net_act,last_cpu_act,last_ext_act); ...@@ -4395,3 +4395,28 @@ last_net_act,last_cpu_act,last_ext_act);
drop primary key, drop primary key,
add primary key (`exptidx`,`slicename`,`plc_idx`); add primary key (`exptidx`,`slicename`,`plc_idx`);
4.144: Add daily stats for generating reports and graphs?
CREATE TABLE `daily_stats` (
`theday` date default NULL,
`exptstart_count` int(11) unsigned default '0',
`exptpreload_count` int(11) unsigned default '0',
`exptswapin_count` int(11) unsigned default '0',
`exptswapout_count` int(11) unsigned default '0',
`exptswapmod_count` int(11) unsigned default '0',
`allexpt_duration` int(11) unsigned default '0',
`allexpt_vnodes` int(11) unsigned default '0',
`allexpt_vnode_duration` int(11) unsigned default '0',
`allexpt_pnodes` int(11) unsigned default '0',
`allexpt_pnode_duration` int(11) unsigned default '0',
PRIMARY KEY (`theday`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
alter table experiment_stats add
`last_activity` datetime default NULL after destroyed;
# this is fine for an initial value.
update experiment_stats set last_activity=created
where last_activity is NULL;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment