aboutsummaryrefslogtreecommitdiff
path: root/crosperf
diff options
context:
space:
mode:
Diffstat (limited to 'crosperf')
-rw-r--r--crosperf/results_cache.py13
-rwxr-xr-xcrosperf/results_cache_unittest.py17
2 files changed, 30 insertions, 0 deletions
diff --git a/crosperf/results_cache.py b/crosperf/results_cache.py
index f7b78e39..b435eee3 100644
--- a/crosperf/results_cache.py
+++ b/crosperf/results_cache.py
@@ -58,6 +58,7 @@ class Result(object):
self.results_file = []
self.turbostat_log_file = ''
self.cpustats_log_file = ''
+ self.cpuinfo_file = ''
self.top_log_file = ''
self.wait_time_log_file = ''
self.chrome_version = ''
@@ -125,6 +126,13 @@ class Result(object):
self.CopyFilesTo(dest_dir, self.results_file)
self.CopyFilesTo(dest_dir, self.perf_data_files)
self.CopyFilesTo(dest_dir, self.perf_report_files)
+ extra_files = []
+ if self.top_log_file:
+ extra_files.append(self.top_log_file)
+ if self.cpuinfo_file:
+ extra_files.append(self.cpuinfo_file)
+ if extra_files:
+ self.CopyFilesTo(dest_dir, extra_files)
if self.results_file or self.perf_data_files or self.perf_report_files:
self._logger.LogOutput('Results files stored in %s.' % dest_dir)
@@ -349,6 +357,10 @@ class Result(object):
"""Get cpustats log path string."""
return self.FindFilesInResultsDir('-name cpustats.log').split('\n')[0]
+ def GetCpuinfoFile(self):
+ """Get cpustats log path string."""
+ return self.FindFilesInResultsDir('-name cpuinfo.log').split('\n')[0]
+
def GetTopFile(self):
"""Get cpustats log path string."""
return self.FindFilesInResultsDir('-name top.log').split('\n')[0]
@@ -455,6 +467,7 @@ class Result(object):
self.perf_report_files = self.GeneratePerfReportFiles()
self.turbostat_log_file = self.GetTurbostatFile()
self.cpustats_log_file = self.GetCpustatsFile()
+ self.cpuinfo_file = self.GetCpuinfoFile()
self.top_log_file = self.GetTopFile()
self.wait_time_log_file = self.GetWaitTimeFile()
# TODO(asharif): Do something similar with perf stat.
diff --git a/crosperf/results_cache_unittest.py b/crosperf/results_cache_unittest.py
index 2c1996c4..812d5ab3 100755
--- a/crosperf/results_cache_unittest.py
+++ b/crosperf/results_cache_unittest.py
@@ -445,6 +445,7 @@ class ResultTest(unittest.TestCase):
self.callGetTurbostatFile = False
self.callGetCpustatsFile = False
self.callGetTopFile = False
+ self.callGetCpuinfoFile = False
self.callGetWaitTimeFile = False
self.args = None
self.callGatherPerfResults = False
@@ -879,6 +880,15 @@ class ResultTest(unittest.TestCase):
self.assertEqual(found_no_logs, '')
@mock.patch.object(command_executer.CommandExecuter, 'RunCommandWOutput')
+ def test_get_cpuinfo_file_finds_single_log(self, mock_runcmd):
+ """Expected behavior when a single cpuinfo file found."""
+ self.result.results_dir = '/tmp/test_results'
+ self.result.ce.RunCommandWOutput = mock_runcmd
+ mock_runcmd.return_value = (0, 'some/long/path/cpuinfo.log', '')
+ found_single_log = self.result.GetCpuinfoFile()
+ self.assertEqual(found_single_log, 'some/long/path/cpuinfo.log')
+
+ @mock.patch.object(command_executer.CommandExecuter, 'RunCommandWOutput')
def test_get_cpustats_file_finds_single_log(self, mock_runcmd):
"""Expected behavior when a single log file found."""
self.result.results_dir = '/tmp/test_results'
@@ -1157,6 +1167,10 @@ class ResultTest(unittest.TestCase):
self.callGetTopFile = True
return []
+ def FakeGetCpuinfoFile():
+ self.callGetCpuinfoFile = True
+ return []
+
def FakeGetWaitTimeFile():
self.callGetWaitTimeFile = True
return []
@@ -1178,6 +1192,7 @@ class ResultTest(unittest.TestCase):
self.callGetTurbostatFile = False
self.callGetCpustatsFile = False
self.callGetTopFile = False
+ self.callGetCpuinfoFile = False
self.callGetWaitTimeFile = False
self.callProcessResults = False
@@ -1188,6 +1203,7 @@ class ResultTest(unittest.TestCase):
self.result.GetTurbostatFile = FakeGetTurbostatFile
self.result.GetCpustatsFile = FakeGetCpustatsFile
self.result.GetTopFile = FakeGetTopFile
+ self.result.GetCpuinfoFile = FakeGetCpuinfoFile
self.result.GetWaitTimeFile = FakeGetWaitTimeFile
self.result.ProcessResults = FakeProcessResults
@@ -1200,6 +1216,7 @@ class ResultTest(unittest.TestCase):
self.assertTrue(self.callGetTurbostatFile)
self.assertTrue(self.callGetCpustatsFile)
self.assertTrue(self.callGetTopFile)
+ self.assertTrue(self.callGetCpuinfoFile)
self.assertTrue(self.callGetWaitTimeFile)
self.assertTrue(self.callProcessResults)