mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-capture: add sysprof_capture_reader_find_file()
This commit is contained in:
@ -1285,3 +1285,34 @@ sysprof_capture_reader_get_byte_order (SysprofCaptureReader *self)
|
||||
|
||||
return self->endian;
|
||||
}
|
||||
|
||||
const SysprofCaptureFileChunk *
|
||||
sysprof_capture_reader_find_file (SysprofCaptureReader *self,
|
||||
const gchar *path)
|
||||
{
|
||||
SysprofCaptureFrameType type;
|
||||
|
||||
g_return_val_if_fail (self != NULL, NULL);
|
||||
g_return_val_if_fail (path != NULL, NULL);
|
||||
|
||||
while (sysprof_capture_reader_peek_type (self, &type))
|
||||
{
|
||||
if (type == SYSPROF_CAPTURE_FRAME_FILE_CHUNK)
|
||||
{
|
||||
const SysprofCaptureFileChunk *fc;
|
||||
|
||||
if (!(fc = sysprof_capture_reader_read_file (self)))
|
||||
break;
|
||||
|
||||
if (g_strcmp0 (path, fc->path) == 0)
|
||||
return fc;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!sysprof_capture_reader_skip (self))
|
||||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -100,6 +100,9 @@ SYSPROF_AVAILABLE_IN_ALL
|
||||
void sysprof_capture_reader_set_stat (SysprofCaptureReader *self,
|
||||
const SysprofCaptureStat *st_buf);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
const SysprofCaptureFileChunk *sysprof_capture_reader_find_file (SysprofCaptureReader *self,
|
||||
const gchar *path);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gchar **sysprof_capture_reader_list_files (SysprofCaptureReader *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gboolean sysprof_capture_reader_read_file_fd (SysprofCaptureReader *self,
|
||||
|
||||
Reference in New Issue
Block a user