License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 08:07:57 -06:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2014-05-23 03:04:42 -06:00
|
|
|
#include "perf.h"
|
|
|
|
#include "util/debug.h"
|
2017-04-25 12:30:47 -06:00
|
|
|
#include "util/event.h"
|
2014-05-23 03:04:42 -06:00
|
|
|
#include "util/symbol.h"
|
|
|
|
#include "util/sort.h"
|
|
|
|
#include "util/evsel.h"
|
|
|
|
#include "util/evlist.h"
|
|
|
|
#include "util/machine.h"
|
|
|
|
#include "util/thread.h"
|
|
|
|
#include "util/parse-events.h"
|
|
|
|
#include "tests/tests.h"
|
|
|
|
#include "tests/hists_common.h"
|
2017-04-17 08:39:06 -06:00
|
|
|
#include <linux/kernel.h>
|
2014-05-23 03:04:42 -06:00
|
|
|
|
|
|
|
struct sample {
|
|
|
|
u32 pid;
|
|
|
|
u64 ip;
|
|
|
|
struct thread *thread;
|
|
|
|
struct map *map;
|
|
|
|
struct symbol *sym;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* For the numbers, see hists_common.c */
|
|
|
|
static struct sample fake_samples[] = {
|
|
|
|
/* perf [kernel] schedule() */
|
|
|
|
{ .pid = FAKE_PID_PERF1, .ip = FAKE_IP_KERNEL_SCHEDULE, },
|
|
|
|
/* perf [perf] main() */
|
|
|
|
{ .pid = FAKE_PID_PERF1, .ip = FAKE_IP_PERF_MAIN, },
|
|
|
|
/* perf [perf] cmd_record() */
|
|
|
|
{ .pid = FAKE_PID_PERF1, .ip = FAKE_IP_PERF_CMD_RECORD, },
|
|
|
|
/* perf [libc] malloc() */
|
|
|
|
{ .pid = FAKE_PID_PERF1, .ip = FAKE_IP_LIBC_MALLOC, },
|
|
|
|
/* perf [libc] free() */
|
|
|
|
{ .pid = FAKE_PID_PERF1, .ip = FAKE_IP_LIBC_FREE, },
|
|
|
|
/* perf [perf] main() */
|
|
|
|
{ .pid = FAKE_PID_PERF2, .ip = FAKE_IP_PERF_MAIN, },
|
|
|
|
/* perf [kernel] page_fault() */
|
|
|
|
{ .pid = FAKE_PID_PERF2, .ip = FAKE_IP_KERNEL_PAGE_FAULT, },
|
|
|
|
/* bash [bash] main() */
|
|
|
|
{ .pid = FAKE_PID_BASH, .ip = FAKE_IP_BASH_MAIN, },
|
|
|
|
/* bash [bash] xmalloc() */
|
|
|
|
{ .pid = FAKE_PID_BASH, .ip = FAKE_IP_BASH_XMALLOC, },
|
|
|
|
/* bash [kernel] page_fault() */
|
|
|
|
{ .pid = FAKE_PID_BASH, .ip = FAKE_IP_KERNEL_PAGE_FAULT, },
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Will be casted to struct ip_callchain which has all 64 bit entries
|
|
|
|
* of nr and ips[].
|
|
|
|
*/
|
|
|
|
static u64 fake_callchains[][10] = {
|
|
|
|
/* schedule => run_command => main */
|
|
|
|
{ 3, FAKE_IP_KERNEL_SCHEDULE, FAKE_IP_PERF_RUN_COMMAND, FAKE_IP_PERF_MAIN, },
|
|
|
|
/* main */
|
|
|
|
{ 1, FAKE_IP_PERF_MAIN, },
|
|
|
|
/* cmd_record => run_command => main */
|
|
|
|
{ 3, FAKE_IP_PERF_CMD_RECORD, FAKE_IP_PERF_RUN_COMMAND, FAKE_IP_PERF_MAIN, },
|
|
|
|
/* malloc => cmd_record => run_command => main */
|
|
|
|
{ 4, FAKE_IP_LIBC_MALLOC, FAKE_IP_PERF_CMD_RECORD, FAKE_IP_PERF_RUN_COMMAND,
|
|
|
|
FAKE_IP_PERF_MAIN, },
|
|
|
|
/* free => cmd_record => run_command => main */
|
|
|
|
{ 4, FAKE_IP_LIBC_FREE, FAKE_IP_PERF_CMD_RECORD, FAKE_IP_PERF_RUN_COMMAND,
|
|
|
|
FAKE_IP_PERF_MAIN, },
|
|
|
|
/* main */
|
|
|
|
{ 1, FAKE_IP_PERF_MAIN, },
|
|
|
|
/* page_fault => sys_perf_event_open => run_command => main */
|
|
|
|
{ 4, FAKE_IP_KERNEL_PAGE_FAULT, FAKE_IP_KERNEL_SYS_PERF_EVENT_OPEN,
|
|
|
|
FAKE_IP_PERF_RUN_COMMAND, FAKE_IP_PERF_MAIN, },
|
|
|
|
/* main */
|
|
|
|
{ 1, FAKE_IP_BASH_MAIN, },
|
|
|
|
/* xmalloc => malloc => xmalloc => malloc => xmalloc => main */
|
|
|
|
{ 6, FAKE_IP_BASH_XMALLOC, FAKE_IP_LIBC_MALLOC, FAKE_IP_BASH_XMALLOC,
|
|
|
|
FAKE_IP_LIBC_MALLOC, FAKE_IP_BASH_XMALLOC, FAKE_IP_BASH_MAIN, },
|
|
|
|
/* page_fault => malloc => main */
|
|
|
|
{ 3, FAKE_IP_KERNEL_PAGE_FAULT, FAKE_IP_LIBC_MALLOC, FAKE_IP_BASH_MAIN, },
|
|
|
|
};
|
|
|
|
|
|
|
|
static int add_hist_entries(struct hists *hists, struct machine *machine)
|
|
|
|
{
|
|
|
|
struct addr_location al;
|
|
|
|
struct perf_evsel *evsel = hists_to_evsel(hists);
|
|
|
|
struct perf_sample sample = { .period = 1000, };
|
|
|
|
size_t i;
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(fake_samples); i++) {
|
|
|
|
struct hist_entry_iter iter = {
|
2015-05-19 02:04:10 -06:00
|
|
|
.evsel = evsel,
|
|
|
|
.sample = &sample,
|
2014-05-23 03:04:42 -06:00
|
|
|
.hide_unresolved = false,
|
|
|
|
};
|
|
|
|
|
|
|
|
if (symbol_conf.cumulate_callchain)
|
|
|
|
iter.ops = &hist_iter_cumulative;
|
|
|
|
else
|
|
|
|
iter.ops = &hist_iter_normal;
|
|
|
|
|
2016-03-22 15:23:43 -06:00
|
|
|
sample.cpumode = PERF_RECORD_MISC_USER;
|
2014-05-23 03:04:42 -06:00
|
|
|
sample.pid = fake_samples[i].pid;
|
|
|
|
sample.tid = fake_samples[i].pid;
|
|
|
|
sample.ip = fake_samples[i].ip;
|
|
|
|
sample.callchain = (struct ip_callchain *)fake_callchains[i];
|
|
|
|
|
2016-03-22 15:39:09 -06:00
|
|
|
if (machine__resolve(machine, &al, &sample) < 0)
|
2014-05-23 03:04:42 -06:00
|
|
|
goto out;
|
|
|
|
|
2016-04-27 07:16:24 -06:00
|
|
|
if (hist_entry_iter__add(&iter, &al, sysctl_perf_event_max_stack,
|
2015-05-19 02:04:10 -06:00
|
|
|
NULL) < 0) {
|
perf machine: Protect the machine->threads with a rwlock
In addition to using refcounts for the struct thread lifetime
management, we need to protect access to machine->threads from
concurrent access.
That happens in 'perf top', where a thread processes events, inserting
and deleting entries from that rb_tree while another thread decays
hist_entries, that end up dropping references and ultimately deleting
threads from the rb_tree and releasing its resources when no further
hist_entry (or other data structures, like in 'perf sched') references
it.
So the rule is the same for refcounts + protected trees in the kernel,
get the tree lock, find object, bump the refcount, drop the tree lock,
return, use object, drop the refcount if no more use of it is needed,
keep it if storing it in some other data structure, drop when releasing
that data structure.
I.e. pair "t = machine__find(new)_thread()" with a "thread__put(t)", and
"perf_event__preprocess_sample(&al)" with "addr_location__put(&al)".
The addr_location__put() one is because as we return references to
several data structures, we may end up adding more reference counting
for the other data structures and then we'll drop it at
addr_location__put() time.
Acked-by: David Ahern <dsahern@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-bs9rt4n0jw3hi9f3zxyy3xln@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-04-06 17:43:22 -06:00
|
|
|
addr_location__put(&al);
|
2014-05-23 03:04:42 -06:00
|
|
|
goto out;
|
perf machine: Protect the machine->threads with a rwlock
In addition to using refcounts for the struct thread lifetime
management, we need to protect access to machine->threads from
concurrent access.
That happens in 'perf top', where a thread processes events, inserting
and deleting entries from that rb_tree while another thread decays
hist_entries, that end up dropping references and ultimately deleting
threads from the rb_tree and releasing its resources when no further
hist_entry (or other data structures, like in 'perf sched') references
it.
So the rule is the same for refcounts + protected trees in the kernel,
get the tree lock, find object, bump the refcount, drop the tree lock,
return, use object, drop the refcount if no more use of it is needed,
keep it if storing it in some other data structure, drop when releasing
that data structure.
I.e. pair "t = machine__find(new)_thread()" with a "thread__put(t)", and
"perf_event__preprocess_sample(&al)" with "addr_location__put(&al)".
The addr_location__put() one is because as we return references to
several data structures, we may end up adding more reference counting
for the other data structures and then we'll drop it at
addr_location__put() time.
Acked-by: David Ahern <dsahern@gmail.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-bs9rt4n0jw3hi9f3zxyy3xln@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-04-06 17:43:22 -06:00
|
|
|
}
|
2014-05-23 03:04:42 -06:00
|
|
|
|
|
|
|
fake_samples[i].thread = al.thread;
|
|
|
|
fake_samples[i].map = al.map;
|
|
|
|
fake_samples[i].sym = al.sym;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TEST_OK;
|
|
|
|
|
|
|
|
out:
|
|
|
|
pr_debug("Not enough memory for adding a hist entry\n");
|
|
|
|
return TEST_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void del_hist_entries(struct hists *hists)
|
|
|
|
{
|
|
|
|
struct hist_entry *he;
|
|
|
|
struct rb_root *root_in;
|
|
|
|
struct rb_root *root_out;
|
|
|
|
struct rb_node *node;
|
|
|
|
|
2016-05-03 05:54:42 -06:00
|
|
|
if (hists__has(hists, need_collapse))
|
2014-05-23 03:04:42 -06:00
|
|
|
root_in = &hists->entries_collapsed;
|
|
|
|
else
|
|
|
|
root_in = hists->entries_in;
|
|
|
|
|
|
|
|
root_out = &hists->entries;
|
|
|
|
|
|
|
|
while (!RB_EMPTY_ROOT(root_out)) {
|
|
|
|
node = rb_first(root_out);
|
|
|
|
|
|
|
|
he = rb_entry(node, struct hist_entry, rb_node);
|
|
|
|
rb_erase(node, root_out);
|
|
|
|
rb_erase(&he->rb_node_in, root_in);
|
2014-12-19 08:31:40 -07:00
|
|
|
hist_entry__delete(he);
|
2014-05-23 03:04:42 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef int (*test_fn_t)(struct perf_evsel *, struct machine *);
|
|
|
|
|
|
|
|
#define COMM(he) (thread__comm_str(he->thread))
|
|
|
|
#define DSO(he) (he->ms.map->dso->short_name)
|
|
|
|
#define SYM(he) (he->ms.sym->name)
|
|
|
|
#define CPU(he) (he->cpu)
|
|
|
|
#define PID(he) (he->thread->tid)
|
|
|
|
#define DEPTH(he) (he->callchain->max_depth)
|
|
|
|
#define CDSO(cl) (cl->ms.map->dso->short_name)
|
|
|
|
#define CSYM(cl) (cl->ms.sym->name)
|
|
|
|
|
|
|
|
struct result {
|
|
|
|
u64 children;
|
|
|
|
u64 self;
|
|
|
|
const char *comm;
|
|
|
|
const char *dso;
|
|
|
|
const char *sym;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct callchain_result {
|
|
|
|
u64 nr;
|
|
|
|
struct {
|
|
|
|
const char *dso;
|
|
|
|
const char *sym;
|
|
|
|
} node[10];
|
|
|
|
};
|
|
|
|
|
|
|
|
static int do_test(struct hists *hists, struct result *expected, size_t nr_expected,
|
|
|
|
struct callchain_result *expected_callchain, size_t nr_callchain)
|
|
|
|
{
|
|
|
|
char buf[32];
|
|
|
|
size_t i, c;
|
|
|
|
struct hist_entry *he;
|
|
|
|
struct rb_root *root;
|
|
|
|
struct rb_node *node;
|
|
|
|
struct callchain_node *cnode;
|
|
|
|
struct callchain_list *clist;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* adding and deleting hist entries must be done outside of this
|
|
|
|
* function since TEST_ASSERT_VAL() returns in case of failure.
|
|
|
|
*/
|
|
|
|
hists__collapse_resort(hists, NULL);
|
2016-01-18 02:24:00 -07:00
|
|
|
perf_evsel__output_resort(hists_to_evsel(hists), NULL);
|
2014-05-23 03:04:42 -06:00
|
|
|
|
|
|
|
if (verbose > 2) {
|
|
|
|
pr_info("use callchain: %d, cumulate callchain: %d\n",
|
|
|
|
symbol_conf.use_callchain,
|
|
|
|
symbol_conf.cumulate_callchain);
|
|
|
|
print_hists_out(hists);
|
|
|
|
}
|
|
|
|
|
|
|
|
root = &hists->entries;
|
|
|
|
for (node = rb_first(root), i = 0;
|
|
|
|
node && (he = rb_entry(node, struct hist_entry, rb_node));
|
|
|
|
node = rb_next(node), i++) {
|
|
|
|
scnprintf(buf, sizeof(buf), "Invalid hist entry #%zd", i);
|
|
|
|
|
|
|
|
TEST_ASSERT_VAL("Incorrect number of hist entry",
|
|
|
|
i < nr_expected);
|
|
|
|
TEST_ASSERT_VAL(buf, he->stat.period == expected[i].self &&
|
|
|
|
!strcmp(COMM(he), expected[i].comm) &&
|
|
|
|
!strcmp(DSO(he), expected[i].dso) &&
|
|
|
|
!strcmp(SYM(he), expected[i].sym));
|
|
|
|
|
|
|
|
if (symbol_conf.cumulate_callchain)
|
|
|
|
TEST_ASSERT_VAL(buf, he->stat_acc->period == expected[i].children);
|
|
|
|
|
|
|
|
if (!symbol_conf.use_callchain)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* check callchain entries */
|
|
|
|
root = &he->callchain->node.rb_root;
|
2016-07-04 06:16:21 -06:00
|
|
|
|
|
|
|
TEST_ASSERT_VAL("callchains expected", !RB_EMPTY_ROOT(root));
|
2014-05-23 03:04:42 -06:00
|
|
|
cnode = rb_entry(rb_first(root), struct callchain_node, rb_node);
|
|
|
|
|
|
|
|
c = 0;
|
|
|
|
list_for_each_entry(clist, &cnode->val, list) {
|
|
|
|
scnprintf(buf, sizeof(buf), "Invalid callchain entry #%zd/%zd", i, c);
|
|
|
|
|
|
|
|
TEST_ASSERT_VAL("Incorrect number of callchain entry",
|
|
|
|
c < expected_callchain[i].nr);
|
|
|
|
TEST_ASSERT_VAL(buf,
|
|
|
|
!strcmp(CDSO(clist), expected_callchain[i].node[c].dso) &&
|
|
|
|
!strcmp(CSYM(clist), expected_callchain[i].node[c].sym));
|
|
|
|
c++;
|
|
|
|
}
|
|
|
|
/* TODO: handle multiple child nodes properly */
|
|
|
|
TEST_ASSERT_VAL("Incorrect number of callchain entry",
|
|
|
|
c <= expected_callchain[i].nr);
|
|
|
|
}
|
|
|
|
TEST_ASSERT_VAL("Incorrect number of hist entry",
|
|
|
|
i == nr_expected);
|
|
|
|
TEST_ASSERT_VAL("Incorrect number of callchain entry",
|
|
|
|
!symbol_conf.use_callchain || nr_expected == nr_callchain);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* NO callchain + NO children */
|
|
|
|
static int test1(struct perf_evsel *evsel, struct machine *machine)
|
|
|
|
{
|
|
|
|
int err;
|
2014-10-09 10:13:41 -06:00
|
|
|
struct hists *hists = evsel__hists(evsel);
|
2014-05-23 03:04:42 -06:00
|
|
|
/*
|
|
|
|
* expected output:
|
|
|
|
*
|
|
|
|
* Overhead Command Shared Object Symbol
|
|
|
|
* ======== ======= ============= ==============
|
|
|
|
* 20.00% perf perf [.] main
|
|
|
|
* 10.00% bash [kernel] [k] page_fault
|
|
|
|
* 10.00% bash bash [.] main
|
|
|
|
* 10.00% bash bash [.] xmalloc
|
|
|
|
* 10.00% perf [kernel] [k] page_fault
|
|
|
|
* 10.00% perf [kernel] [k] schedule
|
|
|
|
* 10.00% perf libc [.] free
|
|
|
|
* 10.00% perf libc [.] malloc
|
|
|
|
* 10.00% perf perf [.] cmd_record
|
|
|
|
*/
|
|
|
|
struct result expected[] = {
|
|
|
|
{ 0, 2000, "perf", "perf", "main" },
|
|
|
|
{ 0, 1000, "bash", "[kernel]", "page_fault" },
|
|
|
|
{ 0, 1000, "bash", "bash", "main" },
|
|
|
|
{ 0, 1000, "bash", "bash", "xmalloc" },
|
|
|
|
{ 0, 1000, "perf", "[kernel]", "page_fault" },
|
|
|
|
{ 0, 1000, "perf", "[kernel]", "schedule" },
|
|
|
|
{ 0, 1000, "perf", "libc", "free" },
|
|
|
|
{ 0, 1000, "perf", "libc", "malloc" },
|
|
|
|
{ 0, 1000, "perf", "perf", "cmd_record" },
|
|
|
|
};
|
|
|
|
|
|
|
|
symbol_conf.use_callchain = false;
|
|
|
|
symbol_conf.cumulate_callchain = false;
|
2015-08-11 04:30:48 -06:00
|
|
|
perf_evsel__reset_sample_bit(evsel, CALLCHAIN);
|
2014-05-23 03:04:42 -06:00
|
|
|
|
2015-12-22 10:07:01 -07:00
|
|
|
setup_sorting(NULL);
|
2014-05-23 03:04:42 -06:00
|
|
|
callchain_register_param(&callchain_param);
|
|
|
|
|
|
|
|
err = add_hist_entries(hists, machine);
|
|
|
|
if (err < 0)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
err = do_test(hists, expected, ARRAY_SIZE(expected), NULL, 0);
|
|
|
|
|
|
|
|
out:
|
|
|
|
del_hist_entries(hists);
|
|
|
|
reset_output_field();
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* callcain + NO children */
|
|
|
|
static int test2(struct perf_evsel *evsel, struct machine *machine)
|
|
|
|
{
|
|
|
|
int err;
|
2014-10-09 10:13:41 -06:00
|
|
|
struct hists *hists = evsel__hists(evsel);
|
2014-05-23 03:04:42 -06:00
|
|
|
/*
|
|
|
|
* expected output:
|
|
|
|
*
|
|
|
|
* Overhead Command Shared Object Symbol
|
|
|
|
* ======== ======= ============= ==============
|
|
|
|
* 20.00% perf perf [.] main
|
|
|
|
* |
|
|
|
|
* --- main
|
|
|
|
*
|
|
|
|
* 10.00% bash [kernel] [k] page_fault
|
|
|
|
* |
|
|
|
|
* --- page_fault
|
|
|
|
* malloc
|
|
|
|
* main
|
|
|
|
*
|
|
|
|
* 10.00% bash bash [.] main
|
|
|
|
* |
|
|
|
|
* --- main
|
|
|
|
*
|
|
|
|
* 10.00% bash bash [.] xmalloc
|
|
|
|
* |
|
|
|
|
* --- xmalloc
|
|
|
|
* malloc
|
|
|
|
* xmalloc <--- NOTE: there's a cycle
|
|
|
|
* malloc
|
|
|
|
* xmalloc
|
|
|
|
* main
|
|
|
|
*
|
|
|
|
* 10.00% perf [kernel] [k] page_fault
|
|
|
|
* |
|
|
|
|
* --- page_fault
|
|
|
|
* sys_perf_event_open
|
|
|
|
* run_command
|
|
|
|
* main
|
|
|
|
*
|
|
|
|
* 10.00% perf [kernel] [k] schedule
|
|
|
|
* |
|
|
|
|
* --- schedule
|
|
|
|
* run_command
|
|
|
|
* main
|
|
|
|
*
|
|
|
|
* 10.00% perf libc [.] free
|
|
|
|
* |
|
|
|
|
* --- free
|
|
|
|
* cmd_record
|
|
|
|
* run_command
|
|
|
|
* main
|
|
|
|
*
|
|
|
|
* 10.00% perf libc [.] malloc
|
|
|
|
* |
|
|
|
|
* --- malloc
|
|
|
|
* cmd_record
|
|
|
|
* run_command
|
|
|
|
* main
|
|
|
|
*
|
|
|
|
* 10.00% perf perf [.] cmd_record
|
|
|
|
* |
|
|
|
|
* --- cmd_record
|
|
|
|
* run_command
|
|
|
|
* main
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
struct result expected[] = {
|
|
|
|
{ 0, 2000, "perf", "perf", "main" },
|
|
|
|
{ 0, 1000, "bash", "[kernel]", "page_fault" },
|
|
|
|
{ 0, 1000, "bash", "bash", "main" },
|
|
|
|
{ 0, 1000, "bash", "bash", "xmalloc" },
|
|
|
|
{ 0, 1000, "perf", "[kernel]", "page_fault" },
|
|
|
|
{ 0, 1000, "perf", "[kernel]", "schedule" },
|
|
|
|
{ 0, 1000, "perf", "libc", "free" },
|
|
|
|
{ 0, 1000, "perf", "libc", "malloc" },
|
|
|
|
{ 0, 1000, "perf", "perf", "cmd_record" },
|
|
|
|
};
|
|
|
|
struct callchain_result expected_callchain[] = {
|
|
|
|
{
|
|
|
|
1, { { "perf", "main" }, },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
3, { { "[kernel]", "page_fault" },
|
|
|
|
{ "libc", "malloc" },
|
|
|
|
{ "bash", "main" }, },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
1, { { "bash", "main" }, },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
6, { { "bash", "xmalloc" },
|
|
|
|
{ "libc", "malloc" },
|
|
|
|
{ "bash", "xmalloc" },
|
|
|
|
{ "libc", "malloc" },
|
|
|
|
{ "bash", "xmalloc" },
|
|
|
|
{ "bash", "main" }, },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
4, { { "[kernel]", "page_fault" },
|
|
|
|
{ "[kernel]", "sys_perf_event_open" },
|
|
|
|
{ "perf", "run_command" },
|
|
|
|
{ "perf", "main" }, },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
3, { { "[kernel]", "schedule" },
|
|
|
|
{ "perf", "run_command" },
|
|
|
|
{ "perf", "main" }, },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
4, { { "libc", "free" },
|
|
|
|
{ "perf", "cmd_record" },
|
|
|
|
{ "perf", "run_command" },
|
|
|
|
{ "perf", "main" }, },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
4, { { "libc", "malloc" },
|
|
|
|
{ "perf", "cmd_record" },
|
|
|
|
{ "perf", "run_command" },
|
|
|
|
{ "perf", "main" }, },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
3, { { "perf", "cmd_record" },
|
|
|
|
{ "perf", "run_command" },
|
|
|
|
{ "perf", "main" }, },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
symbol_conf.use_callchain = true;
|
|
|
|
symbol_conf.cumulate_callchain = false;
|
2015-08-11 04:30:48 -06:00
|
|
|
perf_evsel__set_sample_bit(evsel, CALLCHAIN);
|
2014-05-23 03:04:42 -06:00
|
|
|
|
2015-12-22 10:07:01 -07:00
|
|
|
setup_sorting(NULL);
|
2014-05-23 03:04:42 -06:00
|
|
|
callchain_register_param(&callchain_param);
|
|
|
|
|
|
|
|
err = add_hist_entries(hists, machine);
|
|
|
|
if (err < 0)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
err = do_test(hists, expected, ARRAY_SIZE(expected),
|
|
|
|
expected_callchain, ARRAY_SIZE(expected_callchain));
|
|
|
|
|
|
|
|
out:
|
|
|
|
del_hist_entries(hists);
|
|
|
|
reset_output_field();
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* NO callchain + children */
|
|
|
|
static int test3(struct perf_evsel *evsel, struct machine *machine)
|
|
|
|
{
|
|
|
|
int err;
|
2014-10-09 10:13:41 -06:00
|
|
|
struct hists *hists = evsel__hists(evsel);
|
2014-05-23 03:04:42 -06:00
|
|
|
/*
|
|
|
|
* expected output:
|
|
|
|
*
|
|
|
|
* Children Self Command Shared Object Symbol
|
|
|
|
* ======== ======== ======= ============= =======================
|
|
|
|
* 70.00% 20.00% perf perf [.] main
|
|
|
|
* 50.00% 0.00% perf perf [.] run_command
|
|
|
|
* 30.00% 10.00% bash bash [.] main
|
|
|
|
* 30.00% 10.00% perf perf [.] cmd_record
|
|
|
|
* 20.00% 0.00% bash libc [.] malloc
|
|
|
|
* 10.00% 10.00% bash [kernel] [k] page_fault
|
2014-12-22 21:36:21 -07:00
|
|
|
* 10.00% 10.00% bash bash [.] xmalloc
|
2014-05-23 03:04:42 -06:00
|
|
|
* 10.00% 10.00% perf [kernel] [k] page_fault
|
|
|
|
* 10.00% 10.00% perf libc [.] malloc
|
2014-12-22 21:36:21 -07:00
|
|
|
* 10.00% 10.00% perf [kernel] [k] schedule
|
|
|
|
* 10.00% 10.00% perf libc [.] free
|
|
|
|
* 10.00% 0.00% perf [kernel] [k] sys_perf_event_open
|
2014-05-23 03:04:42 -06:00
|
|
|
*/
|
|
|
|
struct result expected[] = {
|
|
|
|
{ 7000, 2000, "perf", "perf", "main" },
|
|
|
|
{ 5000, 0, "perf", "perf", "run_command" },
|
|
|
|
{ 3000, 1000, "bash", "bash", "main" },
|
|
|
|
{ 3000, 1000, "perf", "perf", "cmd_record" },
|
|
|
|
{ 2000, 0, "bash", "libc", "malloc" },
|
|
|
|
{ 1000, 1000, "bash", "[kernel]", "page_fault" },
|
2014-12-22 21:36:21 -07:00
|
|
|
{ 1000, 1000, "bash", "bash", "xmalloc" },
|
2014-05-23 03:04:42 -06:00
|
|
|
{ 1000, 1000, "perf", "[kernel]", "page_fault" },
|
2014-12-22 21:36:21 -07:00
|
|
|
{ 1000, 1000, "perf", "[kernel]", "schedule" },
|
2014-05-23 03:04:42 -06:00
|
|
|
{ 1000, 1000, "perf", "libc", "free" },
|
|
|
|
{ 1000, 1000, "perf", "libc", "malloc" },
|
2014-12-22 21:36:21 -07:00
|
|
|
{ 1000, 0, "perf", "[kernel]", "sys_perf_event_open" },
|
2014-05-23 03:04:42 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
symbol_conf.use_callchain = false;
|
|
|
|
symbol_conf.cumulate_callchain = true;
|
2015-08-11 04:30:48 -06:00
|
|
|
perf_evsel__reset_sample_bit(evsel, CALLCHAIN);
|
2014-05-23 03:04:42 -06:00
|
|
|
|
2015-12-22 10:07:01 -07:00
|
|
|
setup_sorting(NULL);
|
2014-05-23 03:04:42 -06:00
|
|
|
callchain_register_param(&callchain_param);
|
|
|
|
|
|
|
|
err = add_hist_entries(hists, machine);
|
|
|
|
if (err < 0)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
err = do_test(hists, expected, ARRAY_SIZE(expected), NULL, 0);
|
|
|
|
|
|
|
|
out:
|
|
|
|
del_hist_entries(hists);
|
|
|
|
reset_output_field();
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* callchain + children */
|
|
|
|
static int test4(struct perf_evsel *evsel, struct machine *machine)
|
|
|
|
{
|
|
|
|
int err;
|
2014-10-09 10:13:41 -06:00
|
|
|
struct hists *hists = evsel__hists(evsel);
|
2014-05-23 03:04:42 -06:00
|
|
|
/*
|
|
|
|
* expected output:
|
|
|
|
*
|
|
|
|
* Children Self Command Shared Object Symbol
|
|
|
|
* ======== ======== ======= ============= =======================
|
|
|
|
* 70.00% 20.00% perf perf [.] main
|
|
|
|
* |
|
|
|
|
* --- main
|
|
|
|
*
|
|
|
|
* 50.00% 0.00% perf perf [.] run_command
|
|
|
|
* |
|
|
|
|
* --- run_command
|
|
|
|
* main
|
|
|
|
*
|
|
|
|
* 30.00% 10.00% bash bash [.] main
|
|
|
|
* |
|
|
|
|
* --- main
|
|
|
|
*
|
|
|
|
* 30.00% 10.00% perf perf [.] cmd_record
|
|
|
|
* |
|
|
|
|
* --- cmd_record
|
|
|
|
* run_command
|
|
|
|
* main
|
|
|
|
*
|
|
|
|
* 20.00% 0.00% bash libc [.] malloc
|
|
|
|
* |
|
|
|
|
* --- malloc
|
|
|
|
* |
|
|
|
|
* |--50.00%-- xmalloc
|
|
|
|
* | main
|
|
|
|
* --50.00%-- main
|
|
|
|
*
|
|
|
|
* 10.00% 10.00% bash [kernel] [k] page_fault
|
|
|
|
* |
|
|
|
|
* --- page_fault
|
|
|
|
* malloc
|
|
|
|
* main
|
|
|
|
*
|
2014-12-22 21:36:21 -07:00
|
|
|
* 10.00% 10.00% bash bash [.] xmalloc
|
2014-05-23 03:04:42 -06:00
|
|
|
* |
|
2014-12-22 21:36:21 -07:00
|
|
|
* --- xmalloc
|
|
|
|
* malloc
|
|
|
|
* xmalloc <--- NOTE: there's a cycle
|
|
|
|
* malloc
|
|
|
|
* xmalloc
|
2014-05-23 03:04:42 -06:00
|
|
|
* main
|
|
|
|
*
|
|
|
|
* 10.00% 0.00% perf [kernel] [k] sys_perf_event_open
|
|
|
|
* |
|
|
|
|
* --- sys_perf_event_open
|
|
|
|
* run_command
|
|
|
|
* main
|
|
|
|
*
|
|
|
|
* 10.00% 10.00% perf [kernel] [k] page_fault
|
|
|
|
* |
|
|
|
|
* --- page_fault
|
|
|
|
* sys_perf_event_open
|
|
|
|
* run_command
|
|
|
|
* main
|
|
|
|
*
|
2014-12-22 21:36:21 -07:00
|
|
|
* 10.00% 10.00% perf [kernel] [k] schedule
|
|
|
|
* |
|
|
|
|
* --- schedule
|
|
|
|
* run_command
|
|
|
|
* main
|
|
|
|
*
|
2014-05-23 03:04:42 -06:00
|
|
|
* 10.00% 10.00% perf libc [.] free
|
|
|
|
* |
|
|
|
|
* --- free
|
|
|
|
* cmd_record
|
|
|
|
* run_command
|
|
|
|
* main
|
|
|
|
*
|
|
|
|
* 10.00% 10.00% perf libc [.] malloc
|
|
|
|
* |
|
|
|
|
* --- malloc
|
|
|
|
* cmd_record
|
|
|
|
* run_command
|
|
|
|
* main
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
struct result expected[] = {
|
|
|
|
{ 7000, 2000, "perf", "perf", "main" },
|
|
|
|
{ 5000, 0, "perf", "perf", "run_command" },
|
|
|
|
{ 3000, 1000, "bash", "bash", "main" },
|
|
|
|
{ 3000, 1000, "perf", "perf", "cmd_record" },
|
|
|
|
{ 2000, 0, "bash", "libc", "malloc" },
|
|
|
|
{ 1000, 1000, "bash", "[kernel]", "page_fault" },
|
2014-12-22 21:36:21 -07:00
|
|
|
{ 1000, 1000, "bash", "bash", "xmalloc" },
|
2014-05-23 03:04:42 -06:00
|
|
|
{ 1000, 0, "perf", "[kernel]", "sys_perf_event_open" },
|
|
|
|
{ 1000, 1000, "perf", "[kernel]", "page_fault" },
|
2014-12-22 21:36:21 -07:00
|
|
|
{ 1000, 1000, "perf", "[kernel]", "schedule" },
|
2014-05-23 03:04:42 -06:00
|
|
|
{ 1000, 1000, "perf", "libc", "free" },
|
|
|
|
{ 1000, 1000, "perf", "libc", "malloc" },
|
|
|
|
};
|
|
|
|
struct callchain_result expected_callchain[] = {
|
|
|
|
{
|
|
|
|
1, { { "perf", "main" }, },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
2, { { "perf", "run_command" },
|
|
|
|
{ "perf", "main" }, },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
1, { { "bash", "main" }, },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
3, { { "perf", "cmd_record" },
|
|
|
|
{ "perf", "run_command" },
|
|
|
|
{ "perf", "main" }, },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
4, { { "libc", "malloc" },
|
|
|
|
{ "bash", "xmalloc" },
|
|
|
|
{ "bash", "main" },
|
|
|
|
{ "bash", "main" }, },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
3, { { "[kernel]", "page_fault" },
|
|
|
|
{ "libc", "malloc" },
|
|
|
|
{ "bash", "main" }, },
|
|
|
|
},
|
|
|
|
{
|
2014-12-22 21:36:21 -07:00
|
|
|
6, { { "bash", "xmalloc" },
|
|
|
|
{ "libc", "malloc" },
|
|
|
|
{ "bash", "xmalloc" },
|
|
|
|
{ "libc", "malloc" },
|
|
|
|
{ "bash", "xmalloc" },
|
|
|
|
{ "bash", "main" }, },
|
2014-05-23 03:04:42 -06:00
|
|
|
},
|
|
|
|
{
|
|
|
|
3, { { "[kernel]", "sys_perf_event_open" },
|
|
|
|
{ "perf", "run_command" },
|
|
|
|
{ "perf", "main" }, },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
4, { { "[kernel]", "page_fault" },
|
|
|
|
{ "[kernel]", "sys_perf_event_open" },
|
|
|
|
{ "perf", "run_command" },
|
|
|
|
{ "perf", "main" }, },
|
|
|
|
},
|
2014-12-22 21:36:21 -07:00
|
|
|
{
|
|
|
|
3, { { "[kernel]", "schedule" },
|
|
|
|
{ "perf", "run_command" },
|
|
|
|
{ "perf", "main" }, },
|
|
|
|
},
|
2014-05-23 03:04:42 -06:00
|
|
|
{
|
|
|
|
4, { { "libc", "free" },
|
|
|
|
{ "perf", "cmd_record" },
|
|
|
|
{ "perf", "run_command" },
|
|
|
|
{ "perf", "main" }, },
|
|
|
|
},
|
|
|
|
{
|
|
|
|
4, { { "libc", "malloc" },
|
|
|
|
{ "perf", "cmd_record" },
|
|
|
|
{ "perf", "run_command" },
|
|
|
|
{ "perf", "main" }, },
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
symbol_conf.use_callchain = true;
|
|
|
|
symbol_conf.cumulate_callchain = true;
|
2015-08-11 04:30:48 -06:00
|
|
|
perf_evsel__set_sample_bit(evsel, CALLCHAIN);
|
2014-05-23 03:04:42 -06:00
|
|
|
|
2015-12-22 10:07:01 -07:00
|
|
|
setup_sorting(NULL);
|
2016-07-04 06:16:21 -06:00
|
|
|
|
|
|
|
callchain_param = callchain_param_default;
|
2014-05-23 03:04:42 -06:00
|
|
|
callchain_register_param(&callchain_param);
|
|
|
|
|
|
|
|
err = add_hist_entries(hists, machine);
|
|
|
|
if (err < 0)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
err = do_test(hists, expected, ARRAY_SIZE(expected),
|
|
|
|
expected_callchain, ARRAY_SIZE(expected_callchain));
|
|
|
|
|
|
|
|
out:
|
|
|
|
del_hist_entries(hists);
|
|
|
|
reset_output_field();
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2017-08-03 12:16:31 -06:00
|
|
|
int test__hists_cumulate(struct test *test __maybe_unused, int subtest __maybe_unused)
|
2014-05-23 03:04:42 -06:00
|
|
|
{
|
|
|
|
int err = TEST_FAIL;
|
|
|
|
struct machines machines;
|
|
|
|
struct machine *machine;
|
|
|
|
struct perf_evsel *evsel;
|
|
|
|
struct perf_evlist *evlist = perf_evlist__new();
|
|
|
|
size_t i;
|
|
|
|
test_fn_t testcases[] = {
|
|
|
|
test1,
|
|
|
|
test2,
|
|
|
|
test3,
|
|
|
|
test4,
|
|
|
|
};
|
|
|
|
|
|
|
|
TEST_ASSERT_VAL("No memory", evlist);
|
|
|
|
|
perf tools: Add parse_events_error interface
Adding support to return error information from parse_events function.
Following struct will be populated by parse_events function on return:
struct parse_events_error {
int idx;
char *str;
char *help;
};
where 'idx' is the position in the string where the parsing failed,
'str' contains dynamically allocated error string describing the error
and 'help' is optional help string.
The change contains reporting function, which currently does not display
anything. The code changes to supply error data for specific event types
are coming in next patches. However this is what the expected output is:
$ sudo perf record -e 'sched:krava' ls
event syntax error: 'sched:krava'
\___ unknown tracepoint
...
$ perf record -e 'cpu/even=0x1/' ls
event syntax error: 'cpu/even=0x1/'
\___ unknown term
valid terms: pc,any,inv,edge,cmask,event,in_tx,ldlat,umask,in_tx_cp,offcore_rsp,config,config1,config2,name,period,branch_type
...
$ perf record -e cycles,cache-mises ls
event syntax error: '..es,cache-mises'
\___ parser error
...
The output functions cut the beginning of the event string so the error
starts up to 10th character and cut the end of the string of it crosses
the terminal width.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1429729824-13932-2-git-send-email-jolsa@kernel.org
[ Renamed 'error' variables to 'err', not to clash with util.h error() ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2015-04-22 13:10:16 -06:00
|
|
|
err = parse_events(evlist, "cpu-clock", NULL);
|
2014-05-23 03:04:42 -06:00
|
|
|
if (err)
|
|
|
|
goto out;
|
2016-01-11 06:48:03 -07:00
|
|
|
err = TEST_FAIL;
|
2014-05-23 03:04:42 -06:00
|
|
|
|
|
|
|
machines__init(&machines);
|
|
|
|
|
|
|
|
/* setup threads/dso/map/symbols also */
|
|
|
|
machine = setup_fake_machine(&machines);
|
|
|
|
if (!machine)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
if (verbose > 1)
|
|
|
|
machine__fprintf(machine, stderr);
|
|
|
|
|
|
|
|
evsel = perf_evlist__first(evlist);
|
|
|
|
|
|
|
|
for (i = 0; i < ARRAY_SIZE(testcases); i++) {
|
|
|
|
err = testcases[i](evsel, machine);
|
|
|
|
if (err < 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
|
|
|
/* tear down everything */
|
|
|
|
perf_evlist__delete(evlist);
|
|
|
|
machines__exit(&machines);
|
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|