Stefan Schuermans commited on 2020-10-18 15:23:44
Showing 3 changed files, with 48 additions and 2 deletions.
Double click on process on left side copies shell command to repeat process execution to clipboard.
| ... | ... |
@@ -81,11 +81,23 @@ upt-tool mytrace.upt dump |
| 81 | 81 |
|
| 82 | 82 |
## Graphical User interface |
| 83 | 83 |
|
| 84 |
-To explore a trace in the graphical user interface, run: |
|
| 84 |
+To explore a trace in the graphical user interface (GUI), run: |
|
| 85 | 85 |
``` |
| 86 | 86 |
upt-tool mytrace.upt gui |
| 87 | 87 |
``` |
| 88 | 88 |
|
| 89 |
+The left half of the GUI shows the process tree with a few selected details |
|
| 90 |
+about each process. The right half shows further details of the process |
|
| 91 |
+selected on the left side. |
|
| 92 |
+ |
|
| 93 |
+By double-clicking on the entries in the right tree view, their content can be |
|
| 94 |
+copied to the clipboard. If a row with subordinate rows is double-clicked, the |
|
| 95 |
+contents of all the subordinate entries are copied to the clipboard, using |
|
| 96 |
+proper shell-escaping of the individual entries. If a process row on the left |
|
| 97 |
+side is double-clicked, a shell command for repeating the execution of the |
|
| 98 |
+process (including working directory, environment variables and command line) |
|
| 99 |
+is copied to the clipboard. |
|
| 100 |
+ |
|
| 89 | 101 |
## Example: Trace Build Process |
| 90 | 102 |
|
| 91 | 103 |
To show the capabilities of the UProcTrace, a process that calls several child |
| ... | ... |
@@ -81,6 +81,7 @@ |
| 81 | 81 |
<property name="fixed_height_mode">True</property> |
| 82 | 82 |
<property name="enable_tree_lines">True</property> |
| 83 | 83 |
<signal name="cursor-changed" handler="onProcessesCursorChanged" swapped="no"/> |
| 84 |
+ <signal name="row-activated" handler="onProcessesRowActivated" swapped="no"/> |
|
| 84 | 85 |
<child internal-child="selection"> |
| 85 | 86 |
<object class="GtkTreeSelection"/> |
| 86 | 87 |
</child> |
| ... | ... |
@@ -182,7 +182,8 @@ class UptGui: |
| 182 | 182 |
handlers = {
|
| 183 | 183 |
'onDestroy': self.onDestroy, |
| 184 | 184 |
'onDetailsRowActivated': self.onDetailsRowActivated, |
| 185 |
- 'onProcessesCursorChanged': self.onProcessesCursorChanged |
|
| 185 |
+ 'onProcessesCursorChanged': self.onProcessesCursorChanged, |
|
| 186 |
+ 'onProcessesRowActivated': self.onProcessesRowActivated |
|
| 186 | 187 |
} |
| 187 | 188 |
self.builder.connect_signals(handlers) |
| 188 | 189 |
# open trace file |
| ... | ... |
@@ -296,6 +297,38 @@ class UptGui: |
| 296 | 297 |
# show details of selected process |
| 297 | 298 |
self.showDetails(proc_id) |
| 298 | 299 |
|
| 300 |
+ def onProcessesRowActivated(self, _widget, _row, _col): |
|
| 301 |
+ """ |
|
| 302 |
+ Row in processes view has been activated. |
|
| 303 |
+ """ |
|
| 304 |
+ # get selected row (if any) |
|
| 305 |
+ processes_sel = self.wid_processes_view.get_selection() |
|
| 306 |
+ if processes_sel is None: |
|
| 307 |
+ return |
|
| 308 |
+ processes_iter = processes_sel.get_selected()[1] |
|
| 309 |
+ if processes_iter is None: |
|
| 310 |
+ return |
|
| 311 |
+ # get process |
|
| 312 |
+ proc_id = self.wid_processes_tree.get_value(processes_iter, |
|
| 313 |
+ self.PROC_PROC_ID) |
|
| 314 |
+ if proc_id is None or proc_id < 0: |
|
| 315 |
+ return |
|
| 316 |
+ proc = self.processes.getProcess(proc_id) |
|
| 317 |
+ if proc is None: |
|
| 318 |
+ return |
|
| 319 |
+ # copy shell command line to repeat process call to clipboard |
|
| 320 |
+ # ( cd <workdir>; env -i <environment> <cmdline> ) |
|
| 321 |
+ string = '('
|
|
| 322 |
+ if proc.cwd: |
|
| 323 |
+ string += ' cd ' + cmdline_str_escape(proc.cwd) + ';' |
|
| 324 |
+ if proc.environ: |
|
| 325 |
+ string += ' env -i ' + cmdline2str(sorted(proc.environ)) |
|
| 326 |
+ if proc.cmdline: |
|
| 327 |
+ string += ' ' + cmdline2str(proc.cmdline) |
|
| 328 |
+ string += ' )' |
|
| 329 |
+ self.clipboard.set_text(string, -1) |
|
| 330 |
+ self.clipboard.store() |
|
| 331 |
+ |
|
| 299 | 332 |
def openTrace(self, proto_filename: str): |
| 300 | 333 |
""" |
| 301 | 334 |
Open a trace file. |
| 302 | 335 |