perf evlist: Introduce evlist__for_each() & friends
[linux-2.6-block.git] / tools / perf / tests / hists_link.c
index 4228ffc0d9681d7acda97ecacccf8bea9b76f1e4..2b6519e0e36f09bdbdeac4865fed851f82a3a1ac 100644 (file)
@@ -93,7 +93,7 @@ static struct machine *setup_fake_machine(struct machines *machines)
                if (thread == NULL)
                        goto out;
 
-               thread__set_comm(thread, fake_threads[i].comm);
+               thread__set_comm(thread, fake_threads[i].comm, 0);
        }
 
        for (i = 0; i < ARRAY_SIZE(fake_mmap_info); i++) {
@@ -110,7 +110,7 @@ static struct machine *setup_fake_machine(struct machines *machines)
                strcpy(fake_mmap_event.mmap.filename,
                       fake_mmap_info[i].filename);
 
-               machine__process_mmap_event(machine, &fake_mmap_event);
+               machine__process_mmap_event(machine, &fake_mmap_event, NULL);
        }
 
        for (i = 0; i < ARRAY_SIZE(fake_symbols); i++) {
@@ -208,7 +208,7 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
         * However the second evsel also has a collapsed entry for
         * "bash [libc] malloc" so total 9 entries will be in the tree.
         */
-       list_for_each_entry(evsel, &evlist->entries, node) {
+       evlist__for_each(evlist, evsel) {
                for (k = 0; k < ARRAY_SIZE(fake_common_samples); k++) {
                        const union perf_event event = {
                                .header = {
@@ -222,7 +222,8 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
                                                          &sample) < 0)
                                goto out;
 
-                       he = __hists__add_entry(&evsel->hists, &al, NULL, 1, 1);
+                       he = __hists__add_entry(&evsel->hists, &al, NULL,
+                                               NULL, NULL, 1, 1, 0);
                        if (he == NULL)
                                goto out;
 
@@ -244,7 +245,8 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
                                                          &sample) < 0)
                                goto out;
 
-                       he = __hists__add_entry(&evsel->hists, &al, NULL, 1, 1);
+                       he = __hists__add_entry(&evsel->hists, &al, NULL,
+                                               NULL, NULL, 1, 1, 0);
                        if (he == NULL)
                                goto out;
 
@@ -419,7 +421,7 @@ static void print_hists(struct hists *hists)
                he = rb_entry(node, struct hist_entry, rb_node_in);
 
                pr_info("%2d: entry: %-8s [%-8s] %20s: period = %"PRIu64"\n",
-                       i, he->thread->comm, he->ms.map->dso->short_name,
+                       i, thread__comm_str(he->thread), he->ms.map->dso->short_name,
                        he->ms.sym->name, he->stat.period);
 
                i++;
@@ -464,8 +466,8 @@ int test__hists_link(void)
        if (err < 0)
                goto out;
 
-       list_for_each_entry(evsel, &evlist->entries, node) {
-               hists__collapse_resort(&evsel->hists);
+       evlist__for_each(evlist, evsel) {
+               hists__collapse_resort(&evsel->hists, NULL);
 
                if (verbose > 2)
                        print_hists(&evsel->hists);