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

Regards,
Ramesh


On Wed, Apr 7, 2021 at 11:00 AM <lttng-dev-request@lists.lttng.org> wrote:
Send lttng-dev mailing list submissions to
        lttng-dev@lists.lttng.org

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
        lttng-dev-request@lists.lttng.org

You can reach the person managing the list at
        lttng-dev-owner@lists.lttng.org

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 <jonathan.rajotte-julien@efficios.com>
To: Ramesh Errabolu <ramesh.errabolu@gmail.com>
Cc: lttng-dev@lists.lttng.org
Subject: Re: [lttng-dev] lttng-dev Digest, Vol 156, Issue 3
Message-ID: <20210406234621.GA913141@joraj-alpa>
Content-Type: text/plain; charset=us-ascii

> 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
> 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 <ramesh.errabolu@gmail.com>
To: Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
Cc: lttng-dev@lists.lttng.org
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


On Tue, Apr 6, 2021 at 6:46 PM Jonathan Rajotte-Julien <
jonathan.rajotte-julien@efficios.com> wrote:

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

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

Message: 3
Date: Wed, 7 Apr 2021 11:29:48 -0400 (EDT)
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: Anders Wallin <wallinux@gmail.com>
Cc: lttng-dev <lttng-dev@lists.lttng.org>
Subject: Re: [lttng-dev] [PATCH lttng-tools] testapp: gen-ust-events:
        added help and sync-before-first-event
Message-ID:
        <760733085.60423.1617809388155.JavaMail.zimbra@efficios.com>
Content-Type: text/plain; charset=utf-8

----- On Apr 1, 2021, at 12:36 PM, lttng-dev lttng-dev@lists.lttng.org 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

>
> Signed-off-by: Anders Wallin <wallinux@gmail.com>
> ---
> .../testapp/gen-ust-events/gen-ust-events.c   | 95 ++++++++++++++++---
> 1 file changed, 82 insertions(+), 13 deletions(-)
>
> diff --git a/tests/utils/testapp/gen-ust-events/gen-ust-events.c
> b/tests/utils/testapp/gen-ust-events/gen-ust-events.c
> index df1e58e4..5fefb2d8 100644
> --- a/tests/utils/testapp/gen-ust-events/gen-ust-events.c
> +++ b/tests/utils/testapp/gen-ust-events/gen-ust-events.c
> @@ -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. */
> @@ -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'},
> +#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
> information\n"
> +#ifndef NDEBUG
> +            "  -v  --verbose                                 Print verbose
> messages\n"
> +#endif
> +            "  -i  --iter [iterations]                       Number of iterations,
> default=100, forever=-1\n"
> +            "  -w  --wait [usec]                             Time in usec between
> events, default=0\n"
> +            "  -a  --sync-after-first-event [filename]       Create file after
> first event\n"
> +            "  -b  --sync-before-last-event [filename]       Wait for file before
> writing last event\n"
> +            "  -c  --sync-before-last-event-touch [filename] Create file after last
> event\n"
> +            "  -d  --sync-before-exit [filename]             Wait for file before
> exit\n"
> +            "  -e  --sync-before-exit-touch [filename]       Create file before
> exit\n"
> +            "  -f  --sync-before-first-event [filename]      Wait for file before
> creating the first event\n");
> +}
> +
> int main(int argc, char **argv)
> {
>       unsigned int i, netint;
> @@ -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();
>                       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
> @@ -113,6 +158,7 @@ int main(int argc, char **argv)
>                * we should eventually ensure that all scripts test and report the test
>                * 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);
> +             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",
> +                                   i, before_last_event_file_path_touch);
>                               ret = create_file(before_last_event_file_path_touch);
>                               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",
> +                                   i, before_last_event_file_path);
>                               ret = wait_on_file(before_last_event_file_path);
>                               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) {
> -                     ret = create_file(after_first_event_file_path);
> -
> +             if (after_first_event_file_path_touch && first_event_file_created == 0) {
> +                     TRACE("after_first_event_file_path_touch(%i): %s\n",
> +                           i, after_first_event_file_path_touch);
> +                     ret = create_file(after_first_event_file_path_touch);
>                       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:
> -     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
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> 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 <mathieu.desnoyers@efficios.com>
To: Anders Wallin <wallinux@gmail.com>
Cc: lttng-dev <lttng-dev@lists.lttng.org>
Subject: Re: [lttng-dev] [PATCH lttng-tools] Fix: test code assumes
        that child process is schedule to run before parent
Message-ID:
        <667805472.60438.1617809506670.JavaMail.zimbra@efficios.com>
Content-Type: text/plain; charset=utf-8

----- On Apr 1, 2021, at 12:37 PM, lttng-dev lttng-dev@lists.lttng.org 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

>
> Signed-off-by: Anders Wallin <wallinux@gmail.com>
> ---
> tests/regression/tools/tracker/test_event_tracker | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/tests/regression/tools/tracker/test_event_tracker
> b/tests/regression/tools/tracker/test_event_tracker
> index 711690af..78e9310b 100755
> --- a/tests/regression/tools/tracker/test_event_tracker
> +++ b/tests/regression/tools/tracker/test_event_tracker
> @@ -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/../../.."
> @@ -30,27 +30,24 @@ SCRIPT_GROUPNAME="$(id -gn)"
>
> CHILD_PID=-1
> WAIT_PATH=
> -AFTER_FIRST_PATH=
> -BEFORE_LAST_PATH=
> +BEFORE_FIRST_PATH=
>
> source $TESTDIR/utils/utils.sh
>
> function prepare_ust_app
> {
> -     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
> {
> -     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"
> }
>
> function prepare_kernel_app
> --
> 2.31.1
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev@lists.lttng.org
> 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
lttng-dev@lists.lttng.org
https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


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

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