libsysprof-analyze: add format helper

This commit is contained in:
Christian Hergert
2023-07-05 17:53:44 -07:00
parent d865a0ed99
commit 68cda70138
2 changed files with 18 additions and 5 deletions

View File

@ -151,3 +151,14 @@ sysprof_document_counter_value_get_value_double (SysprofDocumentCounterValue *se
else
return (double)self->value.v_int64;
}
char *
sysprof_document_counter_value_format (SysprofDocumentCounterValue *self)
{
g_return_val_if_fail (SYSPROF_IS_DOCUMENT_COUNTER_VALUE (self), NULL);
if (self->type == SYSPROF_CAPTURE_COUNTER_DOUBLE)
return g_strdup_printf ("%lf", self->value.v_double);
else
return g_strdup_printf ("%ld", self->value.v_int64);
}