Stefan Schuermans commited on 2020-05-24 10:28:53
Showing 2 changed files, with 28 additions and 7 deletions.
| ... | ... |
@@ -4,6 +4,8 @@ |
| 4 | 4 |
<requires lib="gtk+" version="3.20"/> |
| 5 | 5 |
<object class="GtkTreeStore" id="DetailsTree"> |
| 6 | 6 |
<columns> |
| 7 |
+ <!-- column-name proc_id --> |
|
| 8 |
+ <column type="gint"/> |
|
| 7 | 9 |
<!-- column-name key --> |
| 8 | 10 |
<column type="gchararray"/> |
| 9 | 11 |
<!-- column-name value --> |
| ... | ... |
@@ -145,11 +147,11 @@ |
| 145 | 147 |
<property name="clickable">True</property> |
| 146 | 148 |
<property name="reorderable">True</property> |
| 147 | 149 |
<property name="sort_indicator">True</property> |
| 148 |
- <property name="sort_column_id">0</property> |
|
| 150 |
+ <property name="sort_column_id">1</property> |
|
| 149 | 151 |
<child> |
| 150 | 152 |
<object class="GtkCellRendererText" id="DetailsKeyText"/> |
| 151 | 153 |
<attributes> |
| 152 |
- <attribute name="text">0</attribute> |
|
| 154 |
+ <attribute name="text">1</attribute> |
|
| 153 | 155 |
</attributes> |
| 154 | 156 |
</child> |
| 155 | 157 |
</object> |
| ... | ... |
@@ -162,11 +164,11 @@ |
| 162 | 164 |
<property name="clickable">True</property> |
| 163 | 165 |
<property name="reorderable">True</property> |
| 164 | 166 |
<property name="sort_indicator">True</property> |
| 165 |
- <property name="sort_column_id">1</property> |
|
| 167 |
+ <property name="sort_column_id">2</property> |
|
| 166 | 168 |
<child> |
| 167 | 169 |
<object class="GtkCellRendererText" id="DetailsValueText"/> |
| 168 | 170 |
<attributes> |
| 169 |
- <attribute name="text">1</attribute> |
|
| 171 |
+ <attribute name="text">2</attribute> |
|
| 170 | 172 |
</attributes> |
| 171 | 173 |
</child> |
| 172 | 174 |
</object> |
| ... | ... |
@@ -95,8 +95,9 @@ def timestamp2str(timestamp: float) -> str: |
| 95 | 95 |
|
| 96 | 96 |
class UptGui: |
| 97 | 97 |
|
| 98 |
- DETAIL_KEY = 0 |
|
| 99 |
- DETAIL_VALUE = 1 |
|
| 98 |
+ DETAIL_PROC_ID = 0 |
|
| 99 |
+ DETAIL_KEY = 1 |
|
| 100 |
+ DETAIL_VALUE = 2 |
|
| 100 | 101 |
PROC_PROC_ID = 0 |
| 101 | 102 |
PROC_BEGIN = 1 |
| 102 | 103 |
PROC_END = 2 |
| ... | ... |
@@ -173,7 +174,25 @@ class UptGui: |
| 173 | 174 |
add('system CPU time', duration2str(proc.sys_time))
|
| 174 | 175 |
add('user CPU time', duration2str(proc.user_time))
|
| 175 | 176 |
add('working directory', proc.cwd)
|
| 176 |
- # TODO |
|
| 177 |
+ # add parent |
|
| 178 |
+ parent_proc = proc.parent |
|
| 179 |
+ if parent_proc is None: |
|
| 180 |
+ add('parent', '???')
|
|
| 181 |
+ else: |
|
| 182 |
+ parent_iter = add('parent', cmdline2str(parent_proc.cmdline))
|
|
| 183 |
+ self.widDetailsTree.set_value(parent_iter, self.DETAIL_PROC_ID, |
|
| 184 |
+ parent_proc.proc_id) |
|
| 185 |
+ # add children |
|
| 186 |
+ child_procs = proc.children |
|
| 187 |
+ if child_procs is None: |
|
| 188 |
+ add('children', '???')
|
|
| 189 |
+ else: |
|
| 190 |
+ list_iter = add('children', f'{len(child_procs):d} entries')
|
|
| 191 |
+ for i, child_proc in enumerate(child_procs): |
|
| 192 |
+ child_iter = add(f'child {i:d}',
|
|
| 193 |
+ cmdline2str(child_proc.cmdline), list_iter) |
|
| 194 |
+ self.widDetailsTree.set_value(child_iter, self.DETAIL_PROC_ID, |
|
| 195 |
+ child_proc.proc_id) |
|
| 177 | 196 |
|
| 178 | 197 |
def openTrace(self, proto_filename: str): |
| 179 | 198 |
""" |
| 180 | 199 |