|
@@ -36,6 +36,7 @@
|
|
#define ENV "PERF_TEST_ATTR"
|
|
#define ENV "PERF_TEST_ATTR"
|
|
|
|
|
|
static char *dir;
|
|
static char *dir;
|
|
|
|
+static bool ready;
|
|
|
|
|
|
void test_attr__init(void)
|
|
void test_attr__init(void)
|
|
{
|
|
{
|
|
@@ -67,6 +68,9 @@ static int store_event(struct perf_event_attr *attr, pid_t pid, int cpu,
|
|
FILE *file;
|
|
FILE *file;
|
|
char path[PATH_MAX];
|
|
char path[PATH_MAX];
|
|
|
|
|
|
|
|
+ if (!ready)
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
snprintf(path, PATH_MAX, "%s/event-%d-%llu-%d", dir,
|
|
snprintf(path, PATH_MAX, "%s/event-%d-%llu-%d", dir,
|
|
attr->type, attr->config, fd);
|
|
attr->type, attr->config, fd);
|
|
|
|
|
|
@@ -144,6 +148,12 @@ void test_attr__open(struct perf_event_attr *attr, pid_t pid, int cpu,
|
|
errno = errno_saved;
|
|
errno = errno_saved;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void test_attr__ready(void)
|
|
|
|
+{
|
|
|
|
+ if (unlikely(test_attr__enabled) && !ready)
|
|
|
|
+ ready = true;
|
|
|
|
+}
|
|
|
|
+
|
|
static int run_dir(const char *d, const char *perf)
|
|
static int run_dir(const char *d, const char *perf)
|
|
{
|
|
{
|
|
char v[] = "-vvvvv";
|
|
char v[] = "-vvvvv";
|