Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions bin/driver.pl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use constant SQL_HOST_INFO => "INSERT INTO host_info(name,platform,num_cpus,cpu_speed,ram) VALUES(?,?,?,?,?)";
use constant SQL_GET_HOST_ID => "SELECT rowid from host_info where name = ?";
use constant SQL_RUNTIME => "INSERT INTO runtime(label,elapsed_time,user_time,system_time,pcpu,mrss,arss,avg_mem_usage,exit_status,host_id,setup_exit_status,teardown_exit_status) VALUES(?,?,?,?,?,?,?,?,?,?,?,?)";
use constant SQL_SYS_INFO => "INSERT INTO system_info(host_id, used_memory, free_memory, shared_memory, cached_memory, available_memory, pmem_usage, pcpu_usage) VALUES(?,?,?,?,?,?,?,?)";
use constant SQL_SYS_INFO => "INSERT INTO system_info(host_id, used_memory, free_memory, shared_memory, cached_memory, available_memory, pmem_usage, pcpu_usage, test_label) VALUES(?,?,?,?,?,?,?,?,?)";
use constant INVALID_SYSINFO => -1.0;

my $dbname = "data/timings.db";
Expand Down Expand Up @@ -138,7 +138,7 @@ sub main
return if ($$mem{PMEM_USED} == INVALID_SYSINFO or $pcpu == INVALID_SYSINFO);
TRACE("system_info: mem: $$mem{PMEM_USED}%, CPU=$pcpu%");
my @data = ($$mem{USED}, $$mem{FREE}, $$mem{SHARED},
$$mem{CACHED}, $$mem{AVAILABLE}, $$mem{PMEM_USED}, $pcpu);
$$mem{CACHED}, $$mem{AVAILABLE}, $$mem{PMEM_USED}, $pcpu, '');
&save2db($sth_sysinfo, $host_id, @data) unless $dry_run;
}, $sampling_freq);
}
Expand Down Expand Up @@ -173,6 +173,16 @@ sub main
&configure_setting_environment(\%config, $label);
my $tmp_fh = File::Temp->new();
my $cmd = "/usr/bin/time -o $tmp_fh $cmd2time";
unless ($dry_run) {
my $mem = &collect_mem_info();
my $pcpu = &collect_cpu_usage();
if ($$mem{PMEM_USED} != INVALID_SYSINFO and $pcpu != INVALID_SYSINFO) {
TRACE("system_info before $label4run: mem: $$mem{PMEM_USED}%, CPU=$pcpu%");
my @sysdata = ($$mem{USED}, $$mem{FREE}, $$mem{SHARED},
$$mem{CACHED}, $$mem{AVAILABLE}, $$mem{PMEM_USED}, $pcpu, $label4run);
&save2db($sth_sysinfo, $host_id, @sysdata);
}
}
if ($skip_failures) {
try { run($cmd); } catch { $run_number = $num_repeats; }
finally { $exit_code = $IPC::System::Simple::EXITVAL; };
Expand Down
5 changes: 4 additions & 1 deletion ddl/create.sql
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ CREATE TABLE IF NOT EXISTS system_info (
/* pmem_usage computed in bin/driver.pl */
pmem_usage FLOAT CHECK(pmem_usage > 0.0),
pcpu_usage FLOAT CHECK(pcpu_usage > 0.0),
/* label of the test being run when this snapshot was taken */
test_label VARCHAR(255) DEFAULT '',
PRIMARY KEY(timestamp, host_id),
FOREIGN KEY(host_id) REFERENCES host_info(rowid) ON DELETE CASCADE
);
Expand Down Expand Up @@ -91,5 +93,6 @@ SELECT
cached_memory,
available_memory,
pmem_usage,
pcpu_usage
pcpu_usage,
test_label
FROM host_info HI join system_info SI on HI.rowid = SI.host_id;
4 changes: 2 additions & 2 deletions ddl/insert.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ INSERT INTO runtime VALUES("foo", "1", "2", "3", "80", 0, 0, 0, 1, '', '', (sele
INSERT INTO runtime(label, elapsed_time, system_time, user_time, pcpu,host_id) VALUES("bar", 3, 2, 1, 90, (select rowid from host_info where name='blastdev5'));
INSERT INTO runtime(label, elapsed_time, system_time, user_time, pcpu, finished_at, host_id) VALUES("bar", 3, 2, 1, 90, "2020-01-01 15:00:00", (select rowid from host_info where name='blastdev6'));

INSERT INTO system_info(host_id, pmem_usage, pcpu_usage) VALUES((select rowid from host_info where name = "blastdev5"), 55.8, 99.3);
INSERT INTO system_info(host_id, timestamp, pmem_usage, pcpu_usage) VALUES((select rowid from host_info where name = "blastdev5"), "2021-02-18", 57.8, 39.3);
INSERT INTO system_info(host_id, pmem_usage, pcpu_usage, test_label) VALUES((select rowid from host_info where name = "blastdev5"), 55.8, 99.3, 'foo');
INSERT INTO system_info(host_id, timestamp, pmem_usage, pcpu_usage, test_label) VALUES((select rowid from host_info where name = "blastdev5"), "2021-02-18", 57.8, 39.3, 'bar');
/*INSERT INTO runtime VALUES("bar", "-1", "2", "3", "99");*/
-- INSERT INTO export(label) VALUES("foo");