aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-sched.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-11-24 09:05:16 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-24 10:37:02 -0500
commit364794845cbc49e638b83d7ef739524291e1e961 (patch)
treee720975b26d307d6566afb9305c9f6e44290a7da /tools/perf/builtin-sched.c
parentb32d133aec5dc882cf783a293f393bfb3f4379e1 (diff)
perf tools: Introduce zalloc() for the common calloc(1, N) case
This way we type less characters and it looks more like the kzalloc kernel counterpart. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> LKML-Reference: <1259071517-3242-3-git-send-email-acme@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-sched.c')
-rw-r--r--tools/perf/builtin-sched.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index dbf089b12def..19eb708a706b 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -225,7 +225,7 @@ static void calibrate_sleep_measurement_overhead(void)
225static struct sched_atom * 225static struct sched_atom *
226get_new_event(struct task_desc *task, u64 timestamp) 226get_new_event(struct task_desc *task, u64 timestamp)
227{ 227{
228 struct sched_atom *event = calloc(1, sizeof(*event)); 228 struct sched_atom *event = zalloc(sizeof(*event));
229 unsigned long idx = task->nr_events; 229 unsigned long idx = task->nr_events;
230 size_t size; 230 size_t size;
231 231
@@ -293,7 +293,7 @@ add_sched_event_wakeup(struct task_desc *task, u64 timestamp,
293 return; 293 return;
294 } 294 }
295 295
296 wakee_event->wait_sem = calloc(1, sizeof(*wakee_event->wait_sem)); 296 wakee_event->wait_sem = zalloc(sizeof(*wakee_event->wait_sem));
297 sem_init(wakee_event->wait_sem, 0, 0); 297 sem_init(wakee_event->wait_sem, 0, 0);
298 wakee_event->specific_wait = 1; 298 wakee_event->specific_wait = 1;
299 event->wait_sem = wakee_event->wait_sem; 299 event->wait_sem = wakee_event->wait_sem;
@@ -323,7 +323,7 @@ static struct task_desc *register_pid(unsigned long pid, const char *comm)
323 if (task) 323 if (task)
324 return task; 324 return task;
325 325
326 task = calloc(1, sizeof(*task)); 326 task = zalloc(sizeof(*task));
327 task->pid = pid; 327 task->pid = pid;
328 task->nr = nr_tasks; 328 task->nr = nr_tasks;
329 strcpy(task->comm, comm); 329 strcpy(task->comm, comm);
@@ -962,9 +962,7 @@ __thread_latency_insert(struct rb_root *root, struct work_atoms *data,
962 962
963static void thread_atoms_insert(struct thread *thread) 963static void thread_atoms_insert(struct thread *thread)
964{ 964{
965 struct work_atoms *atoms; 965 struct work_atoms *atoms = zalloc(sizeof(*atoms));
966
967 atoms = calloc(sizeof(*atoms), 1);
968 if (!atoms) 966 if (!atoms)
969 die("No memory"); 967 die("No memory");
970 968
@@ -996,9 +994,7 @@ add_sched_out_event(struct work_atoms *atoms,
996 char run_state, 994 char run_state,
997 u64 timestamp) 995 u64 timestamp)
998{ 996{
999 struct work_atom *atom; 997 struct work_atom *atom = zalloc(sizeof(*atom));
1000
1001 atom = calloc(sizeof(*atom), 1);
1002 if (!atom) 998 if (!atom)
1003 die("Non memory"); 999 die("Non memory");
1004 1000