fix errors
Stefan Schuermans

Stefan Schuermans commited on 2020-05-23 16:06:45
Showing 2 changed files, with 15 additions and 15 deletions.

... ...
@@ -56,7 +56,7 @@ class BaseEvent():
56 56
         Get PB2 timespec value in seconds.
57 57
         """
58 58
         sec = t_s.sec
59
-        if t_s.hasField('nsec'):
59
+        if t_s.HasField('nsec'):
60 60
             sec += t_s.nsec * 1e-9
61 61
         return sec
62 62
 
... ...
@@ -110,15 +110,15 @@ class ProcBegin(ProcBeginOrEnd):
110 110
         Initialize process begin event from PB2 event.
111 111
         """
112 112
         super().__init__(pb2_ev)
113
-        p_b = pb2_ev.proc_begin.pid
113
+        p_b = pb2_ev.proc_begin
114 114
         self._pid = p_b.pid
115
-        self._ppid = p_b.ppid if p_b.hasField('ppid') else None
116
-        self._exe = p_b.exe if p_b.hasField('exe') else None
117
-        self._cwd = p_b.cwd if p_b.hasField('cwd') else None
115
+        self._ppid = p_b.ppid if p_b.HasField('ppid') else None
116
+        self._exe = p_b.exe if p_b.HasField('exe') else None
117
+        self._cwd = p_b.cwd if p_b.HasField('cwd') else None
118 118
         self._cmdline = self._pb2GetStringList(
119
-            p_b.cmdline) if p_b.hasField('cmdline') else None
119
+            p_b.cmdline) if p_b.HasField('cmdline') else None
120 120
         self._environ = self._pb2GetStringList(
121
-            p_b.environ) if p_b.hasField('environ') else None
121
+            p_b.environ) if p_b.HasField('environ') else None
122 122
 
123 123
     @property
124 124
     def ppid(self) -> int:
... ...
@@ -168,12 +168,12 @@ class ProcEnd(ProcBeginOrEnd):
168 168
         p_e = pb2_ev.proc_end
169 169
         self._pid = p_e.pid
170 170
         self._cpu_time = self._pb2GetTimespec(
171
-            p_e.cpu_time) if p_e.hasField('cpu_time') else None
171
+            p_e.cpu_time) if p_e.HasField('cpu_time') else None
172 172
         self._user_time = self._pb2GetTimespec(
173
-            p_e.user_time) if p_e.hasField('user_time') else None
173
+            p_e.user_time) if p_e.HasField('user_time') else None
174 174
         self._sys_time = self._pb2GetTimespec(
175
-            p_e.sys_time) if p_e.hasField('sys_time') else None
176
-        self._max_rss_kb = p_e.max_rss_kb if p_e.hasField(
175
+            p_e.sys_time) if p_e.HasField('sys_time') else None
176
+        self._max_rss_kb = p_e.max_rss_kb if p_e.HasField(
177 177
             'max_rss_kb') else None
178 178
 
179 179
     @property
... ...
@@ -238,7 +238,7 @@ def parse_event(proto_file, visitor: Visitor) -> bool:
238 238
     if pb2_ev is None:
239 239
         return False
240 240
     if pb2_ev.HasField('proc_begin'):
241
-        visitor.visitProcBeEnd(ProcBegin(pb2_ev))
241
+        visitor.visitProcBegin(ProcBegin(pb2_ev))
242 242
     if pb2_ev.HasField('proc_end'):
243 243
         visitor.visitProcEnd(ProcEnd(pb2_ev))
244 244
     return True
... ...
@@ -19,7 +19,7 @@ class Process():
19 19
         self._parent = None
20 20
         self._children = list()
21 21
 
22
-    def addChild(self, child: Process):
22
+    def addChild(self, child):
23 23
         """
24 24
         Add a child process.
25 25
         """
... ...
@@ -37,7 +37,7 @@ class Process():
37 37
         """
38 38
         self._end = proc_end
39 39
 
40
-    def setParent(self, parent: Process):
40
+    def setParent(self, parent):
41 41
         """
42 42
         Set parent process.
43 43
         """
... ...
@@ -69,7 +69,7 @@ class Processes(uproctrace.parse.Visitor):
69 69
         Common processing for all events.
70 70
         """
71 71
         # store event in timeline
72
-        self._timeline.setdefault(event.time, list()).append(event)
72
+        self._timeline.setdefault(event.timestamp, list()).append(event)
73 73
 
74 74
     def visitProcBegin(self, proc_begin: uproctrace.parse.ProcBegin):
75 75
         """
76 76