Stefan Schuermans commited on 2020-05-23 19:57:15
Showing 1 changed files, with 11 additions and 3 deletions.
| ... | ... |
@@ -9,10 +9,11 @@ class Process(): |
| 9 | 9 |
""" |
| 10 | 10 |
A process parsed from a trace. |
| 11 | 11 |
""" |
| 12 |
- def __init__(self, pid: int): |
|
| 12 |
+ def __init__(self, proc_id: int, pid: int): |
|
| 13 | 13 |
""" |
| 14 | 14 |
Initialize process. |
| 15 | 15 |
""" |
| 16 |
+ self._proc_id = proc_id |
|
| 16 | 17 |
self._pid = pid |
| 17 | 18 |
self._begin = None |
| 18 | 19 |
self._end = None |
| ... | ... |
@@ -35,6 +36,13 @@ class Process(): |
| 35 | 36 |
return None |
| 36 | 37 |
return self._begin.cmdline |
| 37 | 38 |
|
| 39 |
+ @property |
|
| 40 |
+ def proc_id(self): |
|
| 41 |
+ """ |
|
| 42 |
+ Process ID. (This is not the PID.) |
|
| 43 |
+ """ |
|
| 44 |
+ return self._proc_id |
|
| 45 |
+ |
|
| 38 | 46 |
@property |
| 39 | 47 |
def parent(self): |
| 40 | 48 |
""" |
| ... | ... |
@@ -84,9 +92,9 @@ class Processes(uproctrace.parse.Visitor): |
| 84 | 92 |
|
| 85 | 93 |
def _newProcess(self, pid: int): |
| 86 | 94 |
""" |
| 87 |
- Create new process, set its ID (pid), store it and return it. |
|
| 95 |
+ Create new process, set its PID, store it and return it. |
|
| 88 | 96 |
""" |
| 89 |
- proc = Process(pid) |
|
| 97 |
+ proc = Process(len(self._all_processes), pid) |
|
| 90 | 98 |
self._all_processes.append(proc) |
| 91 | 99 |
return proc |
| 92 | 100 |
|
| 93 | 101 |