mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-profile: remove use of g_alloca in recording fibers
This commit is contained in:
@ -107,14 +107,14 @@ static DexFuture *
|
||||
sysprof_battery_charge_record_fiber (gpointer user_data)
|
||||
{
|
||||
const int invalid_fd = -1;
|
||||
SysprofCaptureCounterValue *values;
|
||||
SysprofCaptureCounter *counters;
|
||||
g_autofree guint *ids = NULL;
|
||||
g_autofree SysprofCaptureCounterValue *values = NULL;
|
||||
g_autofree SysprofCaptureCounter *counters = NULL;
|
||||
g_autofree ReadBuffer *bufs = NULL;
|
||||
SysprofCaptureWriter *writer;
|
||||
Record *record = user_data;
|
||||
g_autoptr(GArray) charge_fds = NULL;
|
||||
g_auto(GStrv) names = NULL;
|
||||
ReadBuffer *bufs;
|
||||
guint *ids;
|
||||
guint n_names;
|
||||
guint n_counters = 1;
|
||||
|
||||
@ -127,10 +127,10 @@ sysprof_battery_charge_record_fiber (gpointer user_data)
|
||||
n_names = g_strv_length (names);
|
||||
|
||||
/* Use some stack space for our counters and values. */
|
||||
ids = g_alloca0 (sizeof *ids * (n_names + 1));
|
||||
counters = g_alloca0 (sizeof *counters * (n_names + 1));
|
||||
values = g_alloca0 (sizeof *values * (n_names + 1));
|
||||
bufs = g_alloca0 (sizeof (ReadBuffer) * (n_names + 1));
|
||||
ids = g_new0 (guint, n_names + 1);
|
||||
counters = g_new0 (SysprofCaptureCounter, n_names + 1);
|
||||
values = g_new0 (SysprofCaptureCounterValue, n_names + 1);
|
||||
bufs = g_new0 (ReadBuffer, n_names + 1);
|
||||
|
||||
/* Setup the combined counter which is the total charge of all of
|
||||
* the batteries we discover on the system.
|
||||
|
||||
@ -127,11 +127,11 @@ sysprof_cpu_usage_record_fiber (gpointer user_data)
|
||||
g_autoptr(GArray) freq_info = NULL;
|
||||
g_autofd int stat_fd = -1;
|
||||
g_autofree char *read_buffer = NULL;
|
||||
SysprofCaptureCounterValue *values;
|
||||
SysprofCaptureCounter *counters;
|
||||
g_autofree SysprofCaptureCounterValue *values = NULL;
|
||||
g_autofree SysprofCaptureCounter *counters = NULL;
|
||||
g_autofree guint *ids = NULL;
|
||||
SysprofCaptureCounter *counter;
|
||||
SysprofCaptureWriter *writer;
|
||||
guint *ids;
|
||||
guint n_cpu;
|
||||
|
||||
g_assert (record != NULL);
|
||||
@ -144,9 +144,9 @@ sysprof_cpu_usage_record_fiber (gpointer user_data)
|
||||
g_unix_set_fd_nonblocking (stat_fd, TRUE, NULL);
|
||||
read_buffer = g_malloc (PROC_STAT_BUF_SIZE);
|
||||
|
||||
counters = g_alloca (sizeof *counters * ((n_cpu * 2) + 1));
|
||||
ids = g_alloca (sizeof *ids * ((n_cpu * 2) + 1));
|
||||
values = g_alloca (sizeof *values * ((n_cpu * 2) + 1));
|
||||
counters = g_new0 (SysprofCaptureCounter, (n_cpu * 2) + 1);
|
||||
ids = g_new0 (guint, (n_cpu * 2) + 1);
|
||||
values = g_new0 (SysprofCaptureCounterValue, (n_cpu * 2) + 1);
|
||||
|
||||
cpu_info = g_array_new (FALSE, TRUE, sizeof (CpuInfo));
|
||||
g_array_set_size (cpu_info, n_cpu);
|
||||
|
||||
Reference in New Issue
Block a user