Move _filter_process method to base command class
authorAntoine Busque <antoinebusque@gmail.com>
Fri, 10 Apr 2015 22:59:39 +0000 (18:59 -0400)
committerAntoine Busque <antoinebusque@gmail.com>
Fri, 10 Apr 2015 22:59:39 +0000 (18:59 -0400)
lttnganalysescli/lttnganalysescli/command.py
lttnganalysescli/lttnganalysescli/io.py
lttnganalysescli/lttnganalysescli/memtop.py
lttnganalysescli/lttnganalysescli/syscallstats.py

index 95c79e355eb3686b3d78da89481c2a6ac509a37c..0ee9c5ebd8e8d8ff9d655c49fd1da03c15a906a4 100644 (file)
@@ -301,3 +301,10 @@ class Command:
     def _create_automaton(self):
         self._automaton = linuxautomaton.automaton.Automaton()
         self.state = self._automaton.state
+
+    def _filter_process(self, proc):
+        if self._arg_proc_list and proc.comm not in self._arg_proc_list:
+            return False
+        if self._arg_pid_list and proc.pid not in self._arg_pid_list:
+            return False
+        return True
index 530383d1bff346a0ed0c5bac080acd303d434b8c..919fb957b13f13bafc4074376c904a6412fcf331 100644 (file)
@@ -104,13 +104,6 @@ class IoAnalysisCommand(Command):
         self._reset_total(end)
 
     # Filter predicates
-    def _filter_process(self, proc):
-        if self._arg_proc_list and proc.comm not in self._arg_proc_list:
-            return False
-        if self._arg_pid_list and proc.pid not in self._arg_pid_list:
-            return False
-        return True
-
     def _filter_size(self, size):
         if size is None:
             return True
index 7440398f75c14670922dd8c70e45cfb7b54d4481..df7c1ced5b07366e98c8dd2e0861ab1c1586d7e8 100644 (file)
@@ -66,14 +66,6 @@ class Memtop(Command):
         self._print_results(begin, end)
         self._reset_total(end)
 
-    def _filter_process(self, proc):
-        if self._arg_proc_list and proc.comm not in self._arg_proc_list:
-            return False
-        if self._arg_pid_list and proc.pid not in self._arg_pid_list:
-            return False
-
-        return True
-
     def _print_results(self, begin_ns, end_ns):
         self._print_date(begin_ns, end_ns)
         self._print_per_tid_alloc()
index 8cfd7ba5ce383aed2075c1a8f8fa6591920c5bc0..930a6b394ec2cc424fcd8ebae9a5a92ccb6618c8 100644 (file)
@@ -64,14 +64,6 @@ class SyscallsAnalysis(Command):
         self._print_results(begin, end)
         self._reset_total(end)
 
-    def _filter_process(self, proc):
-        if self._arg_proc_list and proc.comm not in self._arg_proc_list:
-            return False
-        if self._arg_pid_list and proc.pid not in self._arg_pid_list:
-            return False
-
-        return True
-
     def _print_results(self, begin_ns, end_ns):
         self._print_date(begin_ns, end_ns)
         strformat = '{:<38} {:>14} {:>14} {:>14} {:>12} {:>10}  {:<14}'
This page took 0.027257 seconds and 5 git commands to generate.