libsysprof-analyze: expose exit-time as a property

This commit is contained in:
Christian Hergert
2023-07-06 14:55:07 -07:00
parent 2b29ce8e73
commit 58a089fb94
2 changed files with 23 additions and 0 deletions

View File

@ -38,6 +38,7 @@ struct _SysprofDocumentProcessClass
enum {
PROP_0,
PROP_COMMAND_LINE,
PROP_EXIT_TIME,
N_PROPS
};
@ -69,6 +70,10 @@ sysprof_document_process_get_property (GObject *object,
g_value_set_string (value, sysprof_document_process_get_command_line (self));
break;
case PROP_EXIT_TIME:
g_value_set_int64 (value, sysprof_document_process_get_exit_time (self));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@ -87,6 +92,11 @@ sysprof_document_process_class_init (SysprofDocumentProcessClass *klass)
NULL,
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
properties [PROP_EXIT_TIME] =
g_param_spec_int64 ("exit-time", NULL, NULL,
G_MININT64, G_MAXINT64, 0,
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_properties (object_class, N_PROPS, properties);
}
@ -163,3 +173,14 @@ _sysprof_document_process_set_info (SysprofDocumentProcess *self,
self->process_info = sysprof_process_info_ref (process_info);
}
gint64
sysprof_document_process_get_exit_time (SysprofDocumentProcess *self)
{
g_return_val_if_fail (SYSPROF_IS_DOCUMENT_PROCESS (self), 0);
if (self->process_info != NULL)
return self->process_info->exit_time;
return 0;
}

View File

@ -39,6 +39,8 @@ GType sysprof_document_process_get_type (void) G_GNUC_CONST;
SYSPROF_AVAILABLE_IN_ALL
const char *sysprof_document_process_get_command_line (SysprofDocumentProcess *self);
SYSPROF_AVAILABLE_IN_ALL
gint64 sysprof_document_process_get_exit_time (SysprofDocumentProcess *self);
SYSPROF_AVAILABLE_IN_ALL
GListModel *sysprof_document_process_list_memory_maps (SysprofDocumentProcess *self);
SYSPROF_AVAILABLE_IN_ALL
GListModel *sysprof_document_process_list_mounts (SysprofDocumentProcess *self);