diff mbox series

[1/3] rteval: cyclictest.py Enable logging cyclictest output

Message ID 20210902092452.726905-2-punitagrawal@gmail.com
State New
Headers show
Series [1/3] rteval: cyclictest.py Enable logging cyclictest output | expand

Commit Message

Punit Agrawal Sept. 2, 2021, 9:24 a.m. UTC
From: Punit Agrawal <punit1.agrawal@toshiba.co.jp>

The cyclictest.py module uses a temporary file to store the output
from "cyclictest" which is deleted at the end of the run. As the
collected log contains more information than what is being reported by
rteval it would make sense to persist the logs. It can also be useful
to sanity check the results reported by rteval.

With this goal, create a persistent file named
"cyclictest.stdout" (instead of a tempfile) to capture the cyclictest
logs. The file is stored in the same location as the logs from the
other modules.

Signed-off-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>
---
 rteval/modules/measurement/cyclictest.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

John Kacur Sept. 12, 2021, 3:03 p.m. UTC | #1
On Thu, 2 Sep 2021, Punit Agrawal wrote:

> From: Punit Agrawal <punit1.agrawal@toshiba.co.jp>

> 

> The cyclictest.py module uses a temporary file to store the output

> from "cyclictest" which is deleted at the end of the run. As the

> collected log contains more information than what is being reported by

> rteval it would make sense to persist the logs. It can also be useful

> to sanity check the results reported by rteval.

> 

> With this goal, create a persistent file named

> "cyclictest.stdout" (instead of a tempfile) to capture the cyclictest

> logs. The file is stored in the same location as the logs from the

> other modules.

> 

> Signed-off-by: Punit Agrawal <punit1.agrawal@toshiba.co.jp>

> ---

>  rteval/modules/measurement/cyclictest.py | 5 ++++-

>  1 file changed, 4 insertions(+), 1 deletion(-)

> 

> diff --git a/rteval/modules/measurement/cyclictest.py b/rteval/modules/measurement/cyclictest.py

> index b1755d4f4421..0037c3ad07bd 100644

> --- a/rteval/modules/measurement/cyclictest.py

> +++ b/rteval/modules/measurement/cyclictest.py

> @@ -197,6 +197,7 @@ class Cyclictest(rtevalModulePrototype):

>          self.__numanodes = int(self.__cfg.setdefault('numanodes', 0))

>          self.__priority = int(self.__cfg.setdefault('priority', 95))

>          self.__buckets = int(self.__cfg.setdefault('buckets', 2000))

> +        self.__reportdir = self.__cfg.setdefault('reportdir', os.getcwd())

>          self.__numcores = 0

>          self.__cpus = []

>          self.__cyclicdata = {}

> @@ -255,6 +256,8 @@ class Cyclictest(rtevalModulePrototype):

>          mounts.close()

>          return ret

>  

> +    def _open_logfile(self, name):

> +        return open(os.path.join(self.__reportdir, "logs", name), 'w+b')

>  

>      def _WorkloadSetup(self):

>          self.__cyclicprocess = None

> @@ -288,7 +291,7 @@ class Cyclictest(rtevalModulePrototype):

>              self.__cmd.append("--tracemark")

>  

>          # Buffer for cyclictest data written to stdout

> -        self.__cyclicoutput = tempfile.SpooledTemporaryFile(mode='w+b')

> +        self.__cyclicoutput = self._open_logfile('cyclictest.stdout')

>  

>  

>      def _WorkloadTask(self):

> -- 

> 2.32.0

> 

> 


This is the kind of information that is interesting to developers of 
rteval, but is less interesting to general users who are simply testing 
whether their machines are capable of being used for realtime performance. 
For these people, this would just create large files to be deleted.

I would consider this perhaps with a command line flag explaining this is 
an option for rteval developers.

John
diff mbox series

Patch

diff --git a/rteval/modules/measurement/cyclictest.py b/rteval/modules/measurement/cyclictest.py
index b1755d4f4421..0037c3ad07bd 100644
--- a/rteval/modules/measurement/cyclictest.py
+++ b/rteval/modules/measurement/cyclictest.py
@@ -197,6 +197,7 @@  class Cyclictest(rtevalModulePrototype):
         self.__numanodes = int(self.__cfg.setdefault('numanodes', 0))
         self.__priority = int(self.__cfg.setdefault('priority', 95))
         self.__buckets = int(self.__cfg.setdefault('buckets', 2000))
+        self.__reportdir = self.__cfg.setdefault('reportdir', os.getcwd())
         self.__numcores = 0
         self.__cpus = []
         self.__cyclicdata = {}
@@ -255,6 +256,8 @@  class Cyclictest(rtevalModulePrototype):
         mounts.close()
         return ret
 
+    def _open_logfile(self, name):
+        return open(os.path.join(self.__reportdir, "logs", name), 'w+b')
 
     def _WorkloadSetup(self):
         self.__cyclicprocess = None
@@ -288,7 +291,7 @@  class Cyclictest(rtevalModulePrototype):
             self.__cmd.append("--tracemark")
 
         # Buffer for cyclictest data written to stdout
-        self.__cyclicoutput = tempfile.SpooledTemporaryFile(mode='w+b')
+        self.__cyclicoutput = self._open_logfile('cyclictest.stdout')
 
 
     def _WorkloadTask(self):