libsysprof-analyzer: rename model to SysprofDocument

This will provide better namespacing for the objects inflated from the
document for various frame types. By creating real objects with real
properties we give ourselves quite a bit of flexibility in the data
filtering language coming forth.
This commit is contained in:
Christian Hergert
2023-04-25 15:26:06 -07:00
parent 63a9f498ea
commit ed01673a5e
5 changed files with 104 additions and 51 deletions

View File

@ -6,11 +6,10 @@ int
main (int argc,
char *argv[])
{
SysprofCaptureModel *model;
SysprofDocument *document;
const char *filename;
GError *error = NULL;
guint n_items;
int fd;
sysprof_clock_init ();
@ -21,35 +20,26 @@ main (int argc,
}
filename = argv[1];
fd = open (filename, O_RDONLY|O_CLOEXEC);
if (fd == -1)
{
g_printerr ("Failed to open %s: %s\n",
filename, g_strerror (errno));
return 1;
}
if (!(model = sysprof_capture_model_new_from_fd (fd, &error)))
if (!(document = sysprof_document_new (filename, &error)))
{
g_printerr ("Failed to load %s: %s\n",
filename, error->message);
return 1;
}
n_items = g_list_model_get_n_items (G_LIST_MODEL (model));
n_items = g_list_model_get_n_items (G_LIST_MODEL (document));
g_print ("%u frames\n", n_items);
for (guint i = 0; i < n_items; i++)
{
SysprofCaptureFrameObject *obj = g_list_model_get_item (G_LIST_MODEL (model), i);
SysprofCaptureFrameObject *obj = g_list_model_get_item (G_LIST_MODEL (document), i);
g_clear_object (&obj);
}
close (fd);
g_clear_object (&model);
g_clear_object (&document);
return 0;
}