mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-11 23:51:06 +00:00
libsysprof-analyze: include CPU core-id
This commit is contained in:
@ -24,6 +24,8 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
void _sysprof_cpu_info_set_core_id (SysprofCpuInfo *self,
|
||||||
|
guint core_id);
|
||||||
void _sysprof_cpu_info_set_model_name (SysprofCpuInfo *self,
|
void _sysprof_cpu_info_set_model_name (SysprofCpuInfo *self,
|
||||||
const char *model_name);
|
const char *model_name);
|
||||||
|
|
||||||
|
|||||||
@ -27,11 +27,13 @@ struct _SysprofCpuInfo
|
|||||||
GObject parent_instance;
|
GObject parent_instance;
|
||||||
char *model_name;
|
char *model_name;
|
||||||
guint id;
|
guint id;
|
||||||
|
guint core_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_ID,
|
PROP_ID,
|
||||||
|
PROP_CORE_ID,
|
||||||
PROP_MODEL_NAME,
|
PROP_MODEL_NAME,
|
||||||
N_PROPS
|
N_PROPS
|
||||||
};
|
};
|
||||||
@ -64,6 +66,10 @@ sysprof_cpu_info_get_property (GObject *object,
|
|||||||
g_value_set_uint (value, self->id);
|
g_value_set_uint (value, self->id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_CORE_ID:
|
||||||
|
g_value_set_uint (value, self->core_id);
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_MODEL_NAME:
|
case PROP_MODEL_NAME:
|
||||||
g_value_set_string (value, self->model_name);
|
g_value_set_string (value, self->model_name);
|
||||||
break;
|
break;
|
||||||
@ -87,6 +93,10 @@ sysprof_cpu_info_set_property (GObject *object,
|
|||||||
self->id = g_value_get_uint (value);
|
self->id = g_value_get_uint (value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_CORE_ID:
|
||||||
|
self->core_id = g_value_get_uint (value);
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_MODEL_NAME:
|
case PROP_MODEL_NAME:
|
||||||
self->model_name = g_value_dup_string (value);
|
self->model_name = g_value_dup_string (value);
|
||||||
break;
|
break;
|
||||||
@ -110,6 +120,11 @@ sysprof_cpu_info_class_init (SysprofCpuInfoClass *klass)
|
|||||||
0, G_MAXUINT, 0,
|
0, G_MAXUINT, 0,
|
||||||
(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
properties[PROP_CORE_ID] =
|
||||||
|
g_param_spec_uint ("core-id", NULL, NULL,
|
||||||
|
0, G_MAXUINT, 0,
|
||||||
|
(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
properties[PROP_MODEL_NAME] =
|
properties[PROP_MODEL_NAME] =
|
||||||
g_param_spec_string ("model-name", NULL, NULL,
|
g_param_spec_string ("model-name", NULL, NULL,
|
||||||
NULL,
|
NULL,
|
||||||
@ -148,3 +163,24 @@ _sysprof_cpu_info_set_model_name (SysprofCpuInfo *self,
|
|||||||
if (g_set_str (&self->model_name, model_name))
|
if (g_set_str (&self->model_name, model_name))
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_MODEL_NAME]);
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_MODEL_NAME]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guint
|
||||||
|
sysprof_cpu_info_get_core_id (SysprofCpuInfo *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (SYSPROF_IS_CPU_INFO (self), 0);
|
||||||
|
|
||||||
|
return self->core_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_sysprof_cpu_info_set_core_id (SysprofCpuInfo *self,
|
||||||
|
guint core_id)
|
||||||
|
{
|
||||||
|
g_return_if_fail (SYSPROF_IS_CPU_INFO (self));
|
||||||
|
|
||||||
|
if (self->core_id != core_id)
|
||||||
|
{
|
||||||
|
self->core_id = core_id;
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_CORE_ID]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -34,6 +34,8 @@ G_DECLARE_FINAL_TYPE (SysprofCpuInfo, sysprof_cpu_info, SYSPROF, CPU_INFO, GObje
|
|||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
guint sysprof_cpu_info_get_id (SysprofCpuInfo *self);
|
guint sysprof_cpu_info_get_id (SysprofCpuInfo *self);
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
|
guint sysprof_cpu_info_get_core_id (SysprofCpuInfo *self);
|
||||||
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
const char *sysprof_cpu_info_get_model_name (SysprofCpuInfo *self);
|
const char *sysprof_cpu_info_get_model_name (SysprofCpuInfo *self);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|||||||
@ -1046,6 +1046,14 @@ sysprof_document_load_cpu (SysprofDocument *self)
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (g_str_has_prefix (line, "core id\t\t: "))
|
||||||
|
{
|
||||||
|
gint64 core_id = g_ascii_strtoll (line+strlen("core id\t\t: "), NULL, 10);
|
||||||
|
|
||||||
|
if (core_id > 0)
|
||||||
|
_sysprof_cpu_info_set_core_id (cpu_info, core_id);
|
||||||
|
}
|
||||||
|
|
||||||
if (g_str_has_prefix (line, "model name\t: "))
|
if (g_str_has_prefix (line, "model name\t: "))
|
||||||
{
|
{
|
||||||
const gsize model_name_len = strlen ("model name\t: ");
|
const gsize model_name_len = strlen ("model name\t: ");
|
||||||
|
|||||||
@ -69,6 +69,41 @@
|
|||||||
</property>
|
</property>
|
||||||
</template>
|
</template>
|
||||||
</interface>
|
</interface>
|
||||||
|
]]>
|
||||||
|
</property>
|
||||||
|
</object>
|
||||||
|
</property>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkColumnViewColumn" id="core_id_column">
|
||||||
|
<property name="title" translatable="yes">Core</property>
|
||||||
|
<property name="sorter">
|
||||||
|
<object class="GtkNumericSorter">
|
||||||
|
<property name="expression">
|
||||||
|
<lookup name="core-id" type="SysprofCpuInfo"/>
|
||||||
|
</property>
|
||||||
|
</object>
|
||||||
|
</property>
|
||||||
|
<property name="factory">
|
||||||
|
<object class="GtkBuilderListItemFactory">
|
||||||
|
<property name="bytes"><![CDATA[
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<interface>
|
||||||
|
<template class="GtkListItem">
|
||||||
|
<property name="child">
|
||||||
|
<object class="GtkInscription">
|
||||||
|
<property name="min-chars">2</property>
|
||||||
|
<property name="xalign">1</property>
|
||||||
|
<binding name="text">
|
||||||
|
<lookup name="core-id" type="SysprofCpuInfo">
|
||||||
|
<lookup name="item">GtkListItem</lookup>
|
||||||
|
</lookup>
|
||||||
|
</binding>
|
||||||
|
</object>
|
||||||
|
</property>
|
||||||
|
</template>
|
||||||
|
</interface>
|
||||||
]]>
|
]]>
|
||||||
</property>
|
</property>
|
||||||
</object>
|
</object>
|
||||||
|
|||||||
Reference in New Issue
Block a user