Skip to contentSkip to conversation

Test the parsing of perf raw context

PATCH Superseded Julien Desfossez 2 participants 4 messages Jun 22, 2016 – Jul 5, 2016 2 messages not in the archive

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v2 2/3 Test the parsing of perf raw context

Only test the parsing of the new option in fast_regression since the real integration test requires particular hardware and kernel configuration which might not be available.

---
 tests/fast_regression                |  1 +
 tests/regression/ust/test_event_perf | 46 ++++++++++++++++++++++++++----------
 2 files changed, 34 insertions(+), 13 deletions(-)
tests/fast_regression +1 -0
index 0c4f079..ab5521f 100644
@@ -30,3 +30,4 @@ regression/ust/clock-override/test_clock_override
 regression/ust/rotation-destroy-flush/test_rotation_destroy_flush
 regression/ust/test_event_basic
 regression/ust/test_event_tracef
+regression/ust/test_event_perf
tests/regression/ust/test_event_perf +33 -13

72 lines not on this page · raw message

Signature · 6 lines
1.9.1

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
#2 lore raw

PATCH v2 3/3 Create a dedicated test suite for Perf

In reply to a message not in the archive

Introduce the perf_regression test suite that must be run manually to check if the support for the Perf-related features are available on the current machine. This test cannot be run automatically since there are some platforms where it can fail.

For now, the test only makes sure that we can trace events with perf contexts enabled by raw ID in kernel and user-space. The test only works if libpfm is installed on the system and fails if it is not installed.

---
 .gitignore               |   1 +
 README.md                |   2 +
 configure.ac             |   8 +++
 tests/Makefile.am        |   8 +--
 tests/perf/Makefile.am   |   6 +++
 tests/perf/find_event.c  |  83 ++++++++++++++++++++++++++++++
 tests/perf/test_perf_raw | 129 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/perf_regression    |   1 +
 8 files changed, 234 insertions(+), 4 deletions(-)
 create mode 100644 tests/perf/Makefile.am
 create mode 100644 tests/perf/find_event.c
 create mode 100755 tests/perf/test_perf_raw
 create mode 100644 tests/perf_regression
.gitignore +1 -0
index ac78292..c31dbc5 100644
@@ -106,6 +106,7 @@ tests/regression/ust/python-logging/test_python_logging
 /tests/utils/testapp/gen-ust-tracef/gen-ust-tracef
 /tests/regression/tools/live/live_test
 /tests/unit/ini_config/ini_config
+/tests/perf/find_event
 
 # man pages
 /doc/man/*.1
README.md +2 -0
index 22de252..3156a15 100644
@@ -57,6 +57,8 @@ The following items are _optional_ dependencies:
     pages with the `--help` option or with the `lttng help` command.
     Note that without `man`, you cannot get offline help with
     LTTng-tools commands, not even their usage.
+  - **`libpfm`**: needed to run the perf regression test suite.
+    - Debian/Ubuntu package: `libpfm4-dev`
 
 LTTng-tools supports both the [LTTng Linux Kernel tracer](https://lttng.org)
 and [LTTng user space tracer](https://lttng.org) released as part of the same
configure.ac +8 -0
index d6149fe..5d5f001 100644
@@ -467,6 +467,13 @@ AC_CHECK_LIB([c], [open_memstream],
 ]
 )
 
+# check for libpfm
+AC_CHECK_LIB([pfm], [pfm_initialize],
+	     [
+	      have_libpfm=yes
+	      ])
+AM_CONDITIONAL([LTTNG_TOOLS_BUILD_WITH_LIBPFM], [test "x$have_libpfm" = "xyes"])
+
 AC_ARG_ENABLE([git-version],
               [AC_HELP_STRING([--disable-git-version],
                               [Do not use the git version for the build])],
@@ -1005,6 +1012,7 @@ AC_CONFIG_FILES([
 	tests/regression/ust/clock-override/Makefile
 	tests/regression/ust/type-declarations/Makefile
 	tests/regression/ust/rotation-destroy-flush/Makefile
+	tests/regression/ust/perf/Makefile
 	tests/stress/Makefile
 	tests/unit/Makefile
 	tests/unit/ini_config/Makefile
tests/Makefile.am +4 -4
index 3600e99..d460fb6 100644
@@ -1,8 +1,8 @@
 SUBDIRS =
-DIST_SUBDIRS = utils regression unit stress destructive
+DIST_SUBDIRS = utils regression unit stress destructive perf
 
 if BUILD_TESTS
-SUBDIRS += . utils regression unit stress destructive
+SUBDIRS += . utils regression unit stress destructive perf
 if HAS_PGREP
 check-am:
 	$(top_srcdir)/tests/utils/warn_processes.sh $(PGREP)
@@ -14,8 +14,8 @@ else
 endif
 
 
-dist_noinst_SCRIPTS = run.sh fast_regression long_regression root_regression root_destructive_tests
-EXTRA_DIST = run.sh fast_regression long_regression root_regression README root_destructive_tests
+dist_noinst_SCRIPTS = run.sh fast_regression long_regression root_regression root_destructive_tests perf_regression
+EXTRA_DIST = run.sh fast_regression long_regression root_regression README root_destructive_tests perf_regression
 
 all-local:
 	@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
tests/perf/Makefile.am new file +6 -0
new file mode 100644
index 0000000..40bb754
@@ -0,0 +1,6 @@
+if LTTNG_TOOLS_BUILD_WITH_LIBPFM
+LIBS += -lpfm
+
+noinst_PROGRAMS = find_event
+find_event_SOURCES = find_event.c
+endif
tests/perf/find_event.c new file +83 -0

83 lines not on this page · raw message

tests/perf/test_perf_raw new file +129 -0

129 lines not on this page · raw message

tests/perf_regression new file +1 -0
new file mode 100644
index 0000000..c4b9b86
@@ -0,0 +1 @@
+perf/test_perf_raw
Signature · 6 lines
1.9.1

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
#3 lore raw

Re: [PATCH lttng-tools v2 1/3] Enable perf PMU counters by raw ID

In reply to a message not in the archive
Quoted 6 lines · Julien Desfossez

Allow enabling perf PMU counters by raw ID in addition to the generic list already provided. The format for kernel tracing is "perf:cpu:raw:rNNN:<name>" and "perf:thread:raw:rNNN:<name> for user-space. The rNNN format is the same as perf-record(1) where NNN is a hexadecimal event descriptor in the form of umask+eventsel. The <name> field allows the user to give a more friendly name.

to associate a clearer name to the counter.

Quoted 20 lines

Example usage on Intel i7-3520M to get the unhalted reference cycles (eventsel: 0x13c) count at privilege level 0 (umask: 0x00):
lttng add-context -k -t perf:cpu:raw:r0013c:x86unhalted

Result in the trace:

sched_switch: { cpu_id = 3 }, {
        perf_cpu_raw_r0013c_x86unhalted = 27632578 }, [...]
---
 doc/man/lttng-add-context.1.txt      |  8 +++
 src/bin/lttng/commands/add_context.c | 94 +++++++++++++++++++++++++++++++++++-
 2 files changed, 101 insertions(+), 1 deletion(-)
doc/man/lttng-add-context.1.txt +0 -0
index f995a7f..c43581a 100644

doc/man/lttng-add-context.1.txt per-thread (`perf:thread:` prefix) counters. Currently, per-CPU counters · line 54

Quoted 10 lines
doc/man/lttng-add-context.1.txt +7 -0
@@ -45,6 +45,14 @@ per-thread (`perf:thread:` prefix) counters. Currently, per-CPU counters
 can only be used in the Linux kernel tracing domain, while per-thread
 counters can only be used in the user space tracing domain.
 
+It is also possible to enable PMU counters by raw ID using the
+`perf:cpu:raw:r<N>:<name>` or `perf:thread:raw:r<N>:<name>` format for the
+kernel and user-space respectively. `<N>` is a hexadecimal event descriptor
+which is the same format as perf-record(1): a concatenation of the `Umask
+value` and `Event number` provided by the processors manufacturer. The possible
+values for this field are processor-specific. The `<name>` field is used to
+give a symbolic name to the counter in the trace.

...to associate a...

Quoted 17 lines
doc/man/lttng-add-context.1.txt +1 -0
+
 Application-specific context fields can be added to a channel using the
 following syntax:
 
src/bin/lttng/commands/add_context.c +1 -0
index 2f43dc7..711c1e0 100644
@@ -87,6 +87,7 @@ enum perf_type {
        PERF_TYPE_HARDWARE = 0,
        PERF_TYPE_SOFTWARE = 1,
        PERF_TYPE_HW_CACHE = 3,
+       PERF_TYPE_RAW = 4,
 };
 
 enum perf_count_hard {

src/bin/lttng/commands/add_context.c end: · line 694

Quoted 6 lines
src/bin/lttng/commands/add_context.c +3 -0
@@ -688,9 +689,88 @@ end:
 }
 
 static
+int find_ctx_type_perf_raw(const char *ctx, struct ctx_type *type)
+{
+       char *next;

Reduce scope of "next" to the "for" loop.

src/bin/lttng/commands/add_context.c end: · line 703

Quoted 9 lines
src/bin/lttng/commands/add_context.c +9 -0
+       int ret;
+       int field_pos = 0;
+       char *tmp_list;
+
+       tmp_list = strdup(ctx);
+       if (!tmp_list) {
+               PERROR("strdup temp list");
+               ret = -ENOMEM;
+               goto error;

No need for a separate error label to skip the free() as tmp_list is NULL.

src/bin/lttng/commands/add_context.c end: · line 712

Quoted 9 lines
src/bin/lttng/commands/add_context.c +9 -0
+       }
+
+       /* Looking for "perf:[cpu|thread]:raw:<mask>:<name>". */
+       for (;;) {
+               next = strtok(tmp_list, ":");
+               if (!next) {
+                       break;
+               }
+               tmp_list = NULL;

tmp_list is leaked.

Quoted 20 lines
src/bin/lttng/commands/add_context.c +20 -0
+               switch (field_pos) {
+               case 0:
+                       if (strncmp(next, "perf", 4) != 0) {
+                               ret = -1;
+                               goto end;
+                       }
+                       break;
+               case 1:
+                       if (strncmp(next, "cpu", 3) == 0) {
+                               type->opt->ctx_type = CONTEXT_PERF_CPU_COUNTER;
+                       } else if (strncmp(next, "thread", 4) == 0) {
+                               type->opt->ctx_type = CONTEXT_PERF_THREAD_COUNTER;
+                       } else {
+                               ret = -1;
+                               goto end;
+                       }
+                       break;
+               case 2:
+                       if (strncmp(next, "raw", 3) != 0) {
+                               ret = -1;

src/bin/lttng/commands/add_context.c end: · line 742

Quoted 10 lines
src/bin/lttng/commands/add_context.c +10 -0
+                               goto end;
+                       }
+                       break;
+               case 3:
+                       if (strlen(next) < 2 || next[0] != 'r') {
+                               ERR("Wrong perf raw mask format: rNNN");
+                               ret = -1;
+                               goto end;
+                       }
+                       type->opt->u.perf.config = strtoll(next +  1, NULL, 16);

strtoll() should be checked for error (setting errno to 0 beforehand, and checking after for EINVAL and ERANGE, but also using the endptr).

This currently allows, for instance:
lttng add-context -u -t perf:thread:raw:rXYZ:oops

Such malformed cases should be added to the test suite.

Quoted 4 lines
src/bin/lttng/commands/add_context.c +4 -0
+                       break;
+               case 4:
+                       /* name */
+                       break;

src/bin/lttng/commands/add_context.c end: · line 756

Quoted 10 lines
src/bin/lttng/commands/add_context.c +10 -0
+               case 5:
+                       ERR("Too many ':' in perf raw format");
+                       ret = -1;
+                       goto end;
+               };
+               field_pos++;
+       }
+
+       if (field_pos < 5) {
+               ERR("Wrong perf raw format");

"Invalid perf counter specifier, expected a specifier of the form perf:cpu:raw:rNNN:<name> or perf:thread:raw:rNNN:<name>"

Quoted 47 lines
src/bin/lttng/commands/add_context.c +27 -2
+               ret = -1;
+               goto end;
+       }
+
+       ret = 0;
+       goto end;
+
+end:
+       free(tmp_list);
+error:
+       return ret;
+}
+
+static
 struct ctx_type *get_context_type(const char *ctx)
 {
-       int opt_index;
+       int opt_index, ret;
        struct ctx_type *type = NULL;
        const char app_ctx_prefix[] = "$app.";
        char *provider_name = NULL, *ctx_name = NULL;
@@ -713,6 +793,18 @@ struct ctx_type *get_context_type(const char *ctx)
                goto found;
        }
 
+       /* Check if ctx is a raw perf context. */
+       ret = find_ctx_type_perf_raw(ctx, type);
+       if (ret == 0) {
+               type->opt->u.perf.type = PERF_TYPE_RAW;
+               type->opt->symbol = strdup(ctx);
+               if (!type->opt->symbol) {
+                       PERROR("Copy perf field name");
+                       goto not_found;
+               }
+               goto found;
+       }
+
        /*
         * No match found against static contexts; check if it is an app
         * context.
--

1.9.1

_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Signature · 7 lines
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

Re: [PATCH lttng-tools v2 3/3] Create a dedicated test suite for Perf

Quoted 69 lines · Julien Desfossez

Introduce the perf_regression test suite that must be run manually to check if the support for the Perf-related features are available on the current machine. This test cannot be run automatically since there are some platforms where it can fail.

For now, the test only makes sure that we can trace events with perf contexts enabled by raw ID in kernel and user-space. The test only works if libpfm is installed on the system and fails if it is not installed.

---
 .gitignore               |   1 +
 README.md                |   2 +
 configure.ac             |   8 +++
 tests/Makefile.am        |   8 +--
 tests/perf/Makefile.am   |   6 +++
 tests/perf/find_event.c  |  83 ++++++++++++++++++++++++++++++
 tests/perf/test_perf_raw | 129 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/perf_regression    |   1 +
 8 files changed, 234 insertions(+), 4 deletions(-)
 create mode 100644 tests/perf/Makefile.am
 create mode 100644 tests/perf/find_event.c
 create mode 100755 tests/perf/test_perf_raw
 create mode 100644 tests/perf_regression
.gitignore +1 -0
index ac78292..c31dbc5 100644
@@ -106,6 +106,7 @@ tests/regression/ust/python-logging/test_python_logging
 /tests/utils/testapp/gen-ust-tracef/gen-ust-tracef
 /tests/regression/tools/live/live_test
 /tests/unit/ini_config/ini_config
+/tests/perf/find_event
 
 # man pages
 /doc/man/*.1
README.md +2 -0
index 22de252..3156a15 100644
@@ -57,6 +57,8 @@ The following items are _optional_ dependencies:
     pages with the `--help` option or with the `lttng help` command.
     Note that without `man`, you cannot get offline help with
     LTTng-tools commands, not even their usage.
+  - **`libpfm`**: needed to run the perf regression test suite.
+    - Debian/Ubuntu package: `libpfm4-dev`
 
 LTTng-tools supports both the [LTTng Linux Kernel tracer](https://lttng.org)
 and [LTTng user space tracer](https://lttng.org) released as part of the same
configure.ac +7 -0
index d6149fe..5d5f001 100644
@@ -467,6 +467,13 @@ AC_CHECK_LIB([c], [open_memstream],
 ]
 )
 
+# check for libpfm
+AC_CHECK_LIB([pfm], [pfm_initialize],
+            [
+             have_libpfm=yes
+             ])
+AM_CONDITIONAL([LTTNG_TOOLS_BUILD_WITH_LIBPFM], [test "x$have_libpfm" = "xyes"])
+
 AC_ARG_ENABLE([git-version],
               [AC_HELP_STRING([--disable-git-version],
                               [Do not use the git version for the build])],

configure.ac AC_CONFIG_FILES([ · line 1015

Quoted 4 lines
configure.ac +1 -0
@@ -1005,6 +1012,7 @@ AC_CONFIG_FILES([
        tests/regression/ust/clock-override/Makefile
        tests/regression/ust/type-declarations/Makefile
        tests/regression/ust/rotation-destroy-flush/Makefile
+       tests/regression/ust/perf/Makefile

This patch does not build here.

I think this should point to
tests/perf/Makefile

Quoted 275 lines
configure.ac +0 -0
        tests/stress/Makefile
        tests/unit/Makefile
        tests/unit/ini_config/Makefile
tests/Makefile.am +4 -4
index 3600e99..d460fb6 100644
@@ -1,8 +1,8 @@
 SUBDIRS =
-DIST_SUBDIRS = utils regression unit stress destructive
+DIST_SUBDIRS = utils regression unit stress destructive perf
 
 if BUILD_TESTS
-SUBDIRS += . utils regression unit stress destructive
+SUBDIRS += . utils regression unit stress destructive perf
 if HAS_PGREP
 check-am:
        $(top_srcdir)/tests/utils/warn_processes.sh $(PGREP)
@@ -14,8 +14,8 @@ else
 endif
 
 
-dist_noinst_SCRIPTS = run.sh fast_regression long_regression root_regression root_destructive_tests
-EXTRA_DIST = run.sh fast_regression long_regression root_regression README root_destructive_tests
+dist_noinst_SCRIPTS = run.sh fast_regression long_regression root_regression root_destructive_tests perf_regression
+EXTRA_DIST = run.sh fast_regression long_regression root_regression README root_destructive_tests perf_regression
 
 all-local:
        @if [ x"$(srcdir)" != x"$(builddir)" ]; then \
tests/perf/Makefile.am new file +6 -0
new file mode 100644
index 0000000..40bb754
@@ -0,0 +1,6 @@
+if LTTNG_TOOLS_BUILD_WITH_LIBPFM
+LIBS += -lpfm
+
+noinst_PROGRAMS = find_event
+find_event_SOURCES = find_event.c
+endif
tests/perf/find_event.c new file +83 -0
new file mode 100644
index 0000000..ae63800
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c)  2016 Julien Desfossez <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * as published by the Free Software Foundation; only version 2
+ * of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdio.h>
+#include <perfmon/pfmlib.h>
+#include <string.h>
+
+int main(int argc, char **argv)
+{
+       int ret, i;
+       unsigned int j;
+       pfm_pmu_info_t pinfo;
+
+       if (argc != 2) {
+               fprintf(stderr, "Usage: %s <pmu counter to find>\n"
+                               "ex: %s UNHALTED_REFERENCE_CYCLES\n"
+                               "Returns the first occurence it finds with "
+                               "return code 0.\n"
+                               "If not found returns 1, on error returns -1\n",
+                               argv[0], argv[0]);
+               ret = -1;
+               goto end;
+       }
+
+       memset(&pinfo, 0, sizeof(pinfo));
+       pinfo.size = sizeof(pinfo);
+
+       ret = pfm_initialize();
+       if (ret != PFM_SUCCESS) {
+               fprintf(stderr, "Failed to initialise libpfm: %s",
+                               pfm_strerror(ret));
+               ret = -1;
+               goto end;
+       }
+
+       pfm_for_all_pmus(j) {
+               ret = pfm_get_pmu_info(j, &pinfo);
+               if (ret != PFM_SUCCESS) {
+                       continue;
+               }
+
+               for (i = pinfo.first_event; i != -1; i = pfm_get_event_next(i)) {
+                       pfm_event_info_t info;
+
+                       ret = pfm_get_event_info(i, PFM_OS_NONE, &info);
+                       if (ret != PFM_SUCCESS) {
+                               fprintf(stderr, "Cannot get event info: %s\n",
+                                               pfm_strerror(ret));
+                               ret = -1;
+                               goto end;
+                       }
+
+                       if (info.pmu != j)
+                               continue;
+
+                       if (strcmp(info.name, argv[1]) == 0) {
+                               fprintf(stdout, "r%lx\n", info.code);
+                               ret = 0;
+                               goto end;
+                       }
+               }
+       }
+
+       ret = 1;
+
+end:
+       return ret;
+}
tests/perf/test_perf_raw new file +129 -0
new file mode 100755
index 0000000..68b12d7
@@ -0,0 +1,129 @@
+#!/bin/bash
+#
+# Copyright (C) - 2016 Julien Desfossez <[email protected]>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License, version 2 only, as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, write to the Free Software Foundation, Inc., 51
+# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+TEST_DESC="Perf counters"
+
+CURDIR=$(dirname $0)/
+TESTDIR=$CURDIR/..
+LTTNG_BIN="lttng"
+SESSION_NAME="perf_counters"
+NUM_TESTS=20
+NR_ITER=1
+NR_USEC_WAIT=1
+TESTAPP_PATH="$TESTDIR/utils/testapp"
+TESTAPP_NAME="gen-ust-events"
+TESTAPP_BIN="$TESTAPP_PATH/$TESTAPP_NAME/$TESTAPP_NAME"
+
+source $TESTDIR/utils/utils.sh
+
+function enable_ust_lttng_event_per_chan()
+{
+       sess_name="$1"
+       event_name="$2"
+       chan_name="$3"
+
+       $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$event_name" -s $sess_name -c $chan_name -u >/dev/null 2>&1
+       ok $? "Enable event $event_name for session $sess_name in channel $chan_name"
+}
+
+function test_ust_raw()
+{
+       TRACE_PATH=$(mktemp -d)
+       SESSION_NAME="ust_perf"
+       CHAN_NAME="mychan"
+       EVENT_NAME="tp:tptest"
+       PMU="UNHALTED_REFERENCE_CYCLES"
+       PERFID=$($CURDIR/find_event $PMU)
+       test $? -eq "0"
+       ok $? "Find PMU $PMU"
+
+       create_lttng_session_ok $SESSION_NAME $TRACE_PATH
+
+       enable_ust_lttng_channel_ok $SESSION_NAME $CHAN_NAME
+
+       enable_ust_lttng_event_per_chan $SESSION_NAME $EVENT_NAME $CHAN_NAME
+
+       add_context_ust_ok $SESSION_NAME $CHAN_NAME "perf:thread:raw:${PERFID}:test"
+
+       start_lttng_tracing_ok
+
+       $TESTAPP_BIN $NR_ITER $NR_USEC_WAIT >/dev/null 2>&1
+
+       stop_lttng_tracing_ok
+
+       destroy_lttng_session_ok $SESSION_NAME
+
+       validate_trace "perf_thread_raw_${PERFID}_test" $TRACE_PATH
+
+       rm -rf $TRACE_PATH
+}
+
+function test_kernel_raw()
+{
+       TRACE_PATH=$(mktemp -d)
+       SESSION_NAME="kernel_perf"
+       CHAN_NAME="mychan"
+       EVENT_NAME="lttng_test_filter_event"
+       PMU="UNHALTED_REFERENCE_CYCLES"
+       PERFID=$($CURDIR/find_event $PMU)
+       test $? -eq "0"
+       ok $? "Find PMU $PMU"
+
+       create_lttng_session_ok $SESSION_NAME $TRACE_PATH
+
+       lttng_enable_kernel_channel_ok $SESSION_NAME $CHAN_NAME
+
+       enable_kernel_lttng_event_ok $SESSION_NAME $EVENT_NAME $CHAN_NAME
+
+       add_context_kernel_ok $SESSION_NAME $CHAN_NAME "perf:cpu:raw:${PERFID}:test"
+
+       start_lttng_tracing_ok
+
+       echo -n 10 > /proc/lttng-test-filter-event
+
+       stop_lttng_tracing_ok
+
+       destroy_lttng_session_ok $SESSION_NAME
+
+       validate_trace "perf_cpu_raw_${PERFID}_test" $TRACE_PATH
+
+       rm -rf $TRACE_PATH
+}
+
+if [ "$(id -u)" == "0" ]; then
+       isroot=1
+else
+       isroot=0
+fi
+
+# MUST set TESTDIR before calling those functions
+plan_tests $NUM_TESTS
+
+print_test_banner "$TEST_DESC"
+
+start_lttng_sessiond
+
+test_ust_raw
+
+skip $isroot "Root access is needed for kernel testing, skipping." 9 ||
+{
+       modprobe lttng-test
+       test_kernel_raw
+       rmmod lttng-test
+}
+
+stop_lttng_sessiond
tests/perf_regression new file +1 -1
new file mode 100644
index 0000000..c4b9b86
@@ -0,0 +1 @@
+perf/test_perf_raw
--

1.9.1

Signature · 7 lines
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
_______________________________________________
lttng-dev mailing list
[email protected]
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev