libsysprof-analyze: add api to get size for file

This commit is contained in:
Christian Hergert
2023-05-14 18:36:29 -07:00
parent 6429768373
commit 1bcb534e16
2 changed files with 19 additions and 0 deletions

View File

@ -195,3 +195,20 @@ sysprof_document_file_read (SysprofDocumentFile *self)
return g_steal_pointer (&input);
}
gsize
sysprof_document_file_get_size (SysprofDocumentFile *self)
{
gsize size = 0;
g_return_val_if_fail (SYSPROF_IS_DOCUMENT_FILE (self), 0);
for (guint i = 0; i < self->file_chunks->len; i++)
{
SysprofDocumentFileChunk *file_chunk = g_ptr_array_index (self->file_chunks, i);
size += sysprof_document_file_chunk_get_size (file_chunk);
}
return size;
}

View File

@ -37,5 +37,7 @@ SYSPROF_AVAILABLE_IN_ALL
GBytes *sysprof_document_file_dup_bytes (SysprofDocumentFile *self);
SYSPROF_AVAILABLE_IN_ALL
GInputStream *sysprof_document_file_read (SysprofDocumentFile *self);
SYSPROF_AVAILABLE_IN_ALL
gsize sysprof_document_file_get_size (SysprofDocumentFile *self);
G_END_DECLS