mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
libsysprof-analyze: allow filtering by pid
This commit is contained in:
@ -31,13 +31,17 @@ main (int argc,
|
|||||||
g_autoptr(GListModel) processes = NULL;
|
g_autoptr(GListModel) processes = NULL;
|
||||||
g_autoptr(GError) error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
guint n_items;
|
guint n_items;
|
||||||
|
int pid = -1;
|
||||||
|
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
g_printerr ("usage: %s CAPTURE_FILE\n", argv[0]);
|
g_printerr ("usage: %s CAPTURE_FILE [PID]\n", argv[0]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (argc == 3)
|
||||||
|
pid = atoi (argv[2]);
|
||||||
|
|
||||||
loader = sysprof_document_loader_new (argv[1]);
|
loader = sysprof_document_loader_new (argv[1]);
|
||||||
sysprof_document_loader_set_symbolizer (loader, sysprof_no_symbolizer_get ());
|
sysprof_document_loader_set_symbolizer (loader, sysprof_no_symbolizer_get ());
|
||||||
|
|
||||||
@ -58,6 +62,9 @@ main (int argc,
|
|||||||
guint n_maps;
|
guint n_maps;
|
||||||
guint n_mounts;
|
guint n_mounts;
|
||||||
|
|
||||||
|
if (pid != -1 && pid != sysprof_document_frame_get_pid (SYSPROF_DOCUMENT_FRAME (process)))
|
||||||
|
continue;
|
||||||
|
|
||||||
g_print ("%d: %s\n",
|
g_print ("%d: %s\n",
|
||||||
sysprof_document_frame_get_pid (SYSPROF_DOCUMENT_FRAME (process)),
|
sysprof_document_frame_get_pid (SYSPROF_DOCUMENT_FRAME (process)),
|
||||||
sysprof_document_process_get_command_line (process));
|
sysprof_document_process_get_command_line (process));
|
||||||
|
|||||||
Reference in New Issue
Block a user