libsysprof-profile: make timeout msec tweakable

We may want to tweak this as we discover we can either backoff or
increase our timing intervals.
This commit is contained in:
Christian Hergert
2023-06-04 12:35:04 -07:00
parent a3c235a316
commit 13b76f7de6

View File

@ -94,6 +94,7 @@ typedef struct _SysprofPerfEventSource
{ {
GSource source; GSource source;
SysprofPerfEventStream *stream; SysprofPerfEventStream *stream;
int timeout_msec;
} SysprofPerfEventSource; } SysprofPerfEventSource;
enum { enum {
@ -237,7 +238,7 @@ sysprof_perf_event_source_prepare (GSource *gsource,
SysprofPerfEventStream *self = source->stream; SysprofPerfEventStream *self = source->stream;
if (timeout != NULL) if (timeout != NULL)
*timeout = 5; *timeout = source->timeout_msec;
return self != NULL && return self != NULL &&
self->active && self->active &&
@ -450,6 +451,7 @@ sysprof_perf_event_stream_new (GDBusConnection *connection,
source = (SysprofPerfEventSource *) source = (SysprofPerfEventSource *)
g_source_new (&source_funcs, sizeof (SysprofPerfEventSource)); g_source_new (&source_funcs, sizeof (SysprofPerfEventSource));
source->stream = self; source->stream = self;
source->timeout_msec = 5;
self->source = (GSource *)source; self->source = (GSource *)source;
g_source_set_callback (self->source, sysprof_perf_event_stream_dispatch, self, NULL); g_source_set_callback (self->source, sysprof_perf_event_stream_dispatch, self, NULL);