mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
capture: use uint for requested counter id
Also document this thing so it is more obvious what is going on with the resulting counter ranges.
This commit is contained in:
@ -1150,7 +1150,20 @@ sp_capture_writer_set_counters (SpCaptureWriter *self,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gint
|
||||
/**
|
||||
* sp_capture_writer_request_counter:
|
||||
*
|
||||
* This requests a series of counter identifiers for the capture.
|
||||
*
|
||||
* The returning number is always greater than zero. The resulting counter
|
||||
* values are monotonic starting from the resulting value.
|
||||
*
|
||||
* For example, if you are returned 5, and requested 3 counters, the counter
|
||||
* ids you should use are 5, 6, and 7.
|
||||
*
|
||||
* Returns: The next series of counter values or zero on failure.
|
||||
*/
|
||||
guint
|
||||
sp_capture_writer_request_counter (SpCaptureWriter *self,
|
||||
guint n_counters)
|
||||
{
|
||||
@ -1158,6 +1171,9 @@ sp_capture_writer_request_counter (SpCaptureWriter *self,
|
||||
|
||||
g_assert (self != NULL);
|
||||
|
||||
if (G_MAXUINT - n_counters < self->next_counter_id)
|
||||
return 0;
|
||||
|
||||
ret = self->next_counter_id;
|
||||
self->next_counter_id += n_counters;
|
||||
|
||||
|
||||
@ -106,7 +106,7 @@ gboolean sp_capture_writer_flush (SpCaptureWriter *
|
||||
gboolean sp_capture_writer_save_as (SpCaptureWriter *self,
|
||||
const gchar *filename,
|
||||
GError **error);
|
||||
gint sp_capture_writer_request_counter (SpCaptureWriter *self,
|
||||
guint sp_capture_writer_request_counter (SpCaptureWriter *self,
|
||||
guint n_counters);
|
||||
SpCaptureReader *sp_capture_writer_create_reader (SpCaptureWriter *self,
|
||||
GError **error);
|
||||
|
||||
Reference in New Issue
Block a user