Skip to contentSkip to conversation

lttng-dev Digest, Vol 156, Issue 8

lttng-dev Ramesh Errabolu via lttng-dev 1 participant 1 message Apr 7, 2021 1 message not in the archive

lore
Share & tools
lore

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

#1 lore raw

Is there a dummy test application and libraries one can download and build. I could then validate my setup against it.

Regards,
Ramesh

Quoted 554 lines · On Wed, Apr 7, 2021 at 11:00 AM <[email protected]> wrote:

Send lttng-dev mailing list submissions to
[email protected]

To subscribe or unsubscribe via the World Wide Web, visit
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
or, via email, send a message with subject or body 'help' to
[email protected]

You can reach the person managing the list at
[email protected]

When replying, please edit your Subject line so it is more specific than "Re: Contents of lttng-dev digest..."

Today's Topics:

1. Re: lttng-dev Digest, Vol 156, Issue 3 (Jonathan Rajotte-Julien)
2. Re: lttng-dev Digest, Vol 156, Issue 3 (Ramesh Errabolu)
3. Re: [PATCH lttng-tools] testapp: gen-ust-events: added help and sync-before-first-event (Mathieu Desnoyers)
4. Re: [PATCH lttng-tools] Fix: test code assumes that child process is schedule to run before parent (Mathieu Desnoyers)

----------------------------------------------------------------------

Message: 1
Date: Tue, 6 Apr 2021 19:46:21 -0400
From: Jonathan Rajotte-Julien <[email protected]>
To: Ramesh Errabolu <[email protected]>
Cc: [email protected]
Subject: Re: [lttng-dev] lttng-dev Digest, Vol 156, Issue 3
Message-ID: <20210406234621.GA913141@joraj-alpa>
Content-Type: text/plain; charset=us-ascii

Quoted 3 lines

I followed your command sequence and noticed a bunch of files being created. However when I tried to run babeltrace on these outputs I don't see any of the functions that should have been called. Including below

the

Quoted 1 line

search for symbols.

At least userspace tracing seems to work.

I would recommended, again, that you first try tracing on a dummy application, a
really simple one. Then move to the usage of cyg_profile on that dummy app then
to your application.

The cyg profile events are the following:

lttng_ust_cyg_profile_fast:func_entry
lttng_ust_cyg_profile_fast:func_exit

and, when using liblttng-ust-cyg-profile.so:

lttng_ust_cyg_profile:func_entry
lttng_ust_cyg_profile:func_exit

I would recommend that you first start grep-ing (lttng_ust_cyg) for this in the
trace to see if any is getting hit and recorded. If it is not the case, take a
step back try with a dummy app and if nothing works with the dummy app we can at
least try to help you from there and remove all other variable since you will be
able to share the dummy app with us.

Cheers

------------------------------

Message: 2
Date: Tue, 6 Apr 2021 18:56:39 -0500
From: Ramesh Errabolu <[email protected]>
To: Jonathan Rajotte-Julien <[email protected]>
Cc: [email protected]
Subject: Re: [lttng-dev] lttng-dev Digest, Vol 156, Issue 3 Message-ID:

        <

CAFGSPrwnihLeY_CQm8jYb9B0R2RT52U2SaPeVLVSDsqCyxYKSQ@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Will try the dummy app to check if the basic setup is good. Wondering if being able to trace shared libraries is something not supported.

Regards,
Ramesh

Quoted 2 lines · Jonathan Rajotte-Julien
Quoted 2 lines

I followed your command sequence and noticed a bunch of files being created. However when I tried to run babeltrace on these outputs I

don't

Quoted 9 lines
Quoted 1 line

see any of the functions that should have been called. Including below

the

Quoted 1 line

search for symbols.

At least userspace tracing seems to work.

I would recommended, again, that you first try tracing on a dummy application, a
really simple one. Then move to the usage of cyg_profile on that dummy

app

Quoted 23 lines

then
to your application.

The cyg profile events are the following:

lttng_ust_cyg_profile_fast:func_entry
lttng_ust_cyg_profile_fast:func_exit

and, when using liblttng-ust-cyg-profile.so:

lttng_ust_cyg_profile:func_entry
lttng_ust_cyg_profile:func_exit

I would recommend that you first start grep-ing (lttng_ust_cyg) for this in the
trace to see if any is getting hit and recorded. If it is not the case, take a
step back try with a dummy app and if nothing works with the dummy app we can at
least try to help you from there and remove all other variable since you will be
able to share the dummy app with us.

Quoted 2 lines

Cheers

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <
https://lists.lttng.org/pipermail/lttng-dev/attachments/20210406/f3c5c020/attachment-0001.htm

Quoted 1 line

------------------------------

Message: 3
Date: Wed, 7 Apr 2021 11:29:48 -0400 (EDT)
From: Mathieu Desnoyers <[email protected]>
To: Anders Wallin <[email protected]>
Cc: lttng-dev <[email protected]>
Subject: Re: [lttng-dev] [PATCH lttng-tools] testapp: gen-ust-events:
added help and sync-before-first-event
Message-ID:

        <[email protected]>

Content-Type: text/plain; charset=utf-8

----- On Apr 1, 2021, at 12:36 PM, lttng-dev [email protected]

Quoted 5 lines · wrote:

- added verbose option to print traces
- added sync-before-first-event to wait on file before first event
- added help option
- added missing short option "-e"
- don't allow negative wait times

I don't think this is needed. Will explain in the next patch.

Thanks,

Mathieu

Quoted 36 lines

---
.../testapp/gen-ust-events/gen-ust-events.c | 95 ++++++++++++++++---

1 file changed, 82 insertions(+), 13 deletions(-)
tests/utils/testapp/gen-ust-events/gen-ust-events.c +9 -0
index df1e58e4..5fefb2d8 100644
@@ -28,6 +28,15 @@
 #define TRACEPOINT_DEFINE
 #include "tp.h"
 
+/* #define NDEBUG */
+
+#ifndef NDEBUG
+int verbose;
+#define TRACE(format, ...) { if (verbose) printf(" ---TRACE: " format,
 __VA_ARGS__); }
+#else
+#define TRACE(format, ...)
+#endif
+

static struct option long_options[] =

{
      /* These options set a flag. */
tests/utils/testapp/gen-ust-events/gen-ust-events.c +4 -0
@@ -38,9 +47,33 @@ static struct option long_options[] =
      {"sync-before-last-event-touch", required_argument, 0, 'c'},
      {"sync-before-exit", required_argument, 0, 'd'},
      {"sync-before-exit-touch", required_argument, 0, 'e'},
+     {"sync-before-first-event", required_argument, 0, 'f'},
+     {"help", no_argument, 0, 'h'},
+#ifndef NDEBUG
+     {"verbose", no_argument, 0, 'v'},

tests/utils/testapp/gen-ust-events/gen-ust-events.c static struct option long_options[] = · line 63

Quoted 10 lines
tests/utils/testapp/gen-ust-events/gen-ust-events.c +7 -0
+#endif
      {0, 0, 0, 0}
 };
 
+const char *program_name;
+
+static void print_usage(void)
+{
+     printf("Usage:  %s options\n", program_name);
+     printf("  -h  --help                                    Display

this usage

tests/utils/testapp/gen-ust-events/gen-ust-events.c

Quoted 3 lines

information\n"

tests/utils/testapp/gen-ust-events/gen-ust-events.c +2 -0
+#ifndef NDEBUG
+            "  -v  --verbose                                 Print

verbose

tests/utils/testapp/gen-ust-events/gen-ust-events.c

Quoted 3 lines

messages\n"

tests/utils/testapp/gen-ust-events/gen-ust-events.c +2 -0
+#endif
+            "  -i  --iter [iterations]                       Number of

iterations,

Quoted 2 lines

default=100, forever=-1\n"
+ " -w --wait [usec] Time in

usec between

Quoted 2 lines

events, default=0\n"
+ " -a --sync-after-first-event [filename] Create

file after

Quoted 2 lines

first event\n"
+ " -b --sync-before-last-event [filename] Wait for

file before

Quoted 2 lines

writing last event\n"
+ " -c --sync-before-last-event-touch [filename] Create

file after last

Quoted 2 lines

event\n"
+ " -d --sync-before-exit [filename] Wait for

file before

Quoted 2 lines

exit\n"
+ " -e --sync-before-exit-touch [filename] Create

file before

Quoted 2 lines

exit\n"
+ " -f --sync-before-first-event [filename] Wait for

file before

Quoted 64 lines

creating the first event\n");

tests/utils/testapp/gen-ust-events/gen-ust-events.c +2 -0
+}
+

int main(int argc, char **argv)

{
      unsigned int i, netint;
tests/utils/testapp/gen-ust-events/gen-ust-events.c +19 -7
@@ -54,7 +87,7 @@ int main(int argc, char **argv)
      uint32_t net_values[] = { 1, 2, 3 };
      int nr_iter = 100, ret = 0, first_event_file_created = 0;
      useconds_t nr_usec = 0;
-     char *after_first_event_file_path = NULL;
+     char *after_first_event_file_path_touch = NULL;
      char *before_last_event_file_path = NULL;
      /*
       * Touch a file to indicate that all events except one were
@@ -65,16 +98,20 @@ int main(int argc, char **argv)
      char *before_exit_file_path_touch = NULL;
      /* Wait on file before exiting */
      char *before_exit_file_path = NULL;
+     /* Wait on file before starting */
+     char *before_first_event_file_path = NULL;
+
+     program_name = argv[0];
 
      for (i = 0; i < 3; i++) {
              net_values[i] = htonl(net_values[i]);
      }
 
-     while ((option = getopt_long(argc, argv, "i:w:a:b:c:d:",
+     while ((option = getopt_long(argc, argv, "i:w:a:b:c:d:e:f:hv",
                      long_options, &option_index)) != -1) {
              switch (option) {
              case 'a':
-                     after_first_event_file_path = strdup(optarg);
+                     after_first_event_file_path_touch = strdup(optarg);
                      break;
              case 'b':
                      before_last_event_file_path = strdup(optarg);
@@ -88,22 +125,30 @@ int main(int argc, char **argv)
              case 'e':
                      before_exit_file_path_touch = strdup(optarg);
                      break;
+             case 'f':
+                     before_first_event_file_path = strdup(optarg);
+                     break;
              case 'i':
                      nr_iter = atoi(optarg);
                      break;
+#ifndef NDEBUG
+             case 'v':
+                     verbose = 1;
+                     break;
+#endif
              case 'w':
-                     nr_usec = atoi(optarg);
+                     /* only postive values are valid */
+                     nr_usec = (atoi(optarg) < 0) ? 0 : atoi(optarg);
                      break;
-             case '?':
-                     /* getopt_long already printed an error message. */
+             case 'h':
              default:
-                     ret = -1;
+                     print_usage();

tests/utils/testapp/gen-ust-events/gen-ust-events.c int main(int argc, char **argv) · line 154

Quoted 10 lines
tests/utils/testapp/gen-ust-events/gen-ust-events.c +1 -1
                      goto end;
              }
      }
 
      if (optind != argc) {
-             fprintf(stderr, "Error: takes long options only.\n");
+             fprintf(stderr, "Error: takes options only.\n");
 
              /*
               * Aborting the test program for now because callers

typically don't check

tests/utils/testapp/gen-ust-events/gen-ust-events.c int main(int argc, char **argv) · line 158

Quoted 2 lines
tests/utils/testapp/gen-ust-events/gen-ust-events.c +0 -0
@@ -113,6 +158,7 @@ int main(int argc, char **argv)
               * we should eventually ensure that all scripts test and

report the test

Quoted 16 lines
tests/utils/testapp/gen-ust-events/gen-ust-events.c +7 -0
               * app return values.
               */
+             print_usage();
              abort();
 
              ret = -1;
@@ -125,9 +171,23 @@ int main(int argc, char **argv)
              goto end;
      }
 
+     TRACE("iter: %i\n", nr_iter);
+     TRACE("wait: %i (usec)\n", nr_usec);
+
+     if (before_first_event_file_path) {
+             TRACE("before_first_event_file_path(%i): %s\n",
+                   -1, before_first_event_file_path);

tests/utils/testapp/gen-ust-events/gen-ust-events.c int main(int argc, char **argv) · line 189

Quoted 10 lines
tests/utils/testapp/gen-ust-events/gen-ust-events.c +7 -0
+             ret = wait_on_file(before_first_event_file_path);
+             if (ret != 0) {
+                     goto end;
+             }
+     }
+
      for (i = 0; nr_iter < 0 || i < nr_iter; i++) {
              if (nr_iter >= 0 && i == nr_iter - 1) {
                      if (before_last_event_file_path_touch) {
+

TRACE("before_last_event_file_path_touch(%i): %s\n",

tests/utils/testapp/gen-ust-events/gen-ust-events.c int main(int argc, char **argv) · line 190

Quoted 1 line
tests/utils/testapp/gen-ust-events/gen-ust-events.c +1 -0
+                                   i,

before_last_event_file_path_touch);

tests/utils/testapp/gen-ust-events/gen-ust-events.c int main(int argc, char **argv) · line 191

Quoted 1 line
tests/utils/testapp/gen-ust-events/gen-ust-events.c +0 -0
                              ret =

create_file(before_last_event_file_path_touch);

tests/utils/testapp/gen-ust-events/gen-ust-events.c int main(int argc, char **argv) · line 202

Quoted 7 lines
tests/utils/testapp/gen-ust-events/gen-ust-events.c +1 -0
                              if (ret != 0) {
                                      goto end;
@@ -139,6 +199,8 @@ int main(int argc, char **argv)
                       * event.
                       */
                      if (before_last_event_file_path) {
+                             TRACE("before_last_event_file_path(%i):

%s\n",

tests/utils/testapp/gen-ust-events/gen-ust-events.c int main(int argc, char **argv) · line 204

Quoted 2 lines
tests/utils/testapp/gen-ust-events/gen-ust-events.c +1 -0
+                                   i, before_last_event_file_path);
                              ret =

wait_on_file(before_last_event_file_path);

tests/utils/testapp/gen-ust-events/gen-ust-events.c int main(int argc, char **argv) · line 156

Quoted 7 lines
tests/utils/testapp/gen-ust-events/gen-ust-events.c +0 -1
                              if (ret != 0) {
                                      goto end;
@@ -153,9 +215,10 @@ int main(int argc, char **argv)
               * First loop we create the file if asked to indicate
               * that at least one tracepoint has been hit.
               */
-             if (after_first_event_file_path &&

first_event_file_created == 0) {

tests/utils/testapp/gen-ust-events/gen-ust-events.c int main(int argc, char **argv) · line 218

Quoted 3 lines
tests/utils/testapp/gen-ust-events/gen-ust-events.c +1 -2
-                     ret = create_file(after_first_event_file_path);
-
+             if (after_first_event_file_path_touch &&

first_event_file_created == 0) {

tests/utils/testapp/gen-ust-events/gen-ust-events.c int main(int argc, char **argv) · line 219

Quoted 1 line
tests/utils/testapp/gen-ust-events/gen-ust-events.c +1 -0
+                     TRACE("after_first_event_file_path_touch(%i):

%s\n",

tests/utils/testapp/gen-ust-events/gen-ust-events.c int main(int argc, char **argv) · line 221

Quoted 2 lines
tests/utils/testapp/gen-ust-events/gen-ust-events.c +2 -0
+                           i, after_first_event_file_path_touch);
+                     ret =

create_file(after_first_event_file_path_touch);

Quoted 45 lines
tests/utils/testapp/gen-ust-events/gen-ust-events.c +5 -1
                      if (ret != 0) {
                              goto end;
                      } else {
@@ -164,7 +227,7 @@ int main(int argc, char **argv)
              }
 
              if (nr_usec) {
-                     if (usleep_safe(nr_usec)) {
+                     if (usleep_safe(nr_usec)) {
                              ret = -1;
                              goto end;
                      }
@@ -175,22 +238,28 @@ int main(int argc, char **argv)
      }
 
      if (before_exit_file_path_touch) {
+             TRACE("before_exit_file_path_touch(%i): %s\n",
+                   i, before_exit_file_path_touch);
              ret = create_file(before_exit_file_path_touch);
              if (ret != 0) {
                      goto end;
              }
      }
      if (before_exit_file_path) {
+             TRACE("before_exit_file_path(%i): %s\n",
+                   i, before_exit_file_path);
              ret = wait_on_file(before_exit_file_path);
              if (ret != 0) {
                      goto end;
              }
      }

end:

tests/utils/testapp/gen-ust-events/gen-ust-events.c +3 -1
-     free(after_first_event_file_path);
+     TRACE("end status: %i\n", ret);
+     free(after_first_event_file_path_touch);
      free(before_last_event_file_path);
      free(before_last_event_file_path_touch);
      free(before_exit_file_path);
      free(before_exit_file_path_touch);
+     free(before_first_event_file_path);
      exit(!ret ? EXIT_SUCCESS : EXIT_FAILURE);

}
--
2.31.1

Quoted 4 lines

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

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

------------------------------

Message: 4
Date: Wed, 7 Apr 2021 11:31:46 -0400 (EDT)
From: Mathieu Desnoyers <[email protected]>
To: Anders Wallin <[email protected]>
Cc: lttng-dev <[email protected]>
Subject: Re: [lttng-dev] [PATCH lttng-tools] Fix: test code assumes
that child process is schedule to run before parent
Message-ID:

        <[email protected]>

Content-Type: text/plain; charset=utf-8

----- On Apr 1, 2021, at 12:37 PM, lttng-dev [email protected]

Quoted 5 lines · wrote:

the following tests fails
- test_event_vpid_tracker ust 0 "${EVENT_NAME}"
- test_event_vpid_track_untrack ust 0 "${EVENT_NAME}"
- test_event_pid_tracker ust 0 "${EVENT_NAME}"
- test_event_pid_track_untrack ust 0 "${EVENT_NAME}"

There is indeed an issue with these tests: there is a missing "untrack all pids"
which should be done at the very beginning of each test to have the expected
behavior. AFAIU this explains why there is a small window where traced applications
can generate events when none are expected.

Fixing this should solve the issues without requiring any addition to the test
program.

Thanks,

Mathieu

Quoted 54 lines

---
tests/regression/tools/tracker/test_event_tracker | 15 ++++++---------

1 file changed, 6 insertions(+), 9 deletions(-)
tests/regression/tools/tracker/test_event_tracker +1 -1
index 711690af..78e9310b 100755
@@ -5,7 +5,7 @@
 #
 # SPDX-License-Identifier: GPL-2.0-only
 
-TEST_DESC="LTTng - Event traker test"
+TEST_DESC="LTTng - Event tracker test"
 

CURDIR=$(dirname "$0")/
TESTDIR="$CURDIR/../../.."

tests/regression/tools/tracker/test_event_tracker +0 -0
@@ -30,27 +30,24 @@ SCRIPT_GROUPNAME="$(id -gn)"
 

CHILD_PID=-1
WAIT_PATH=

tests/regression/tools/tracker/test_event_tracker +1 -2
-AFTER_FIRST_PATH=
-BEFORE_LAST_PATH=
+BEFORE_FIRST_PATH=

source $TESTDIR/utils/utils.sh

function prepare_ust_app
{

tests/regression/tools/tracker/test_event_tracker +1 -3
-     AFTER_FIRST_PATH=$(mktemp -u)
-     BEFORE_LAST_PATH=$(mktemp -u)
+     BEFORE_FIRST_PATH=$(mktemp -u)
 
-     $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT -a "$AFTER_FIRST_PATH" -b

"$BEFORE_LAST_PATH" &
+ $TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-before-first-event
"$BEFORE_FIRST_PATH" &

      CHILD_PID=$!
}

function trace_ust_app
{

tests/regression/tools/tracker/test_event_tracker +2 -3
-     touch "$BEFORE_LAST_PATH"
+     touch "$BEFORE_FIRST_PATH"
      wait
      ok $? "Traced application stopped."
-     rm "$BEFORE_LAST_PATH"
-     rm "$AFTER_FIRST_PATH"
+     rm "$BEFORE_FIRST_PATH"

}

Quoted 8 lines

function prepare_kernel_app
--
2.31.1

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

--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

------------------------------

Subject: Digest Footer

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

Quoted 5 lines

------------------------------

End of lttng-dev Digest, Vol 156, Issue 8
*****************************************

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