Commit Graph

23 Commits

Author SHA1 Message Date
Marc Herbert 327a26bf8a logger: make "global_config" truly global
Finish the job that commit 5b29dae9c8 ("logger: Create global
convert_config variable to avoid spaghetti code.") started but did not
finish, leaving behind a supposedly "global" variable that is actually a
confusing global pointer to a struct local to the main() function.

This confuses some static analyzer complaining that stack values are
being returned, see #6858 and #6738. This is a false positive
because the main()'s stack lifespan is the same as a global but let's
simplify things anyway.

Also stop using 'extern' in .c files, use a proper .h file instead.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2022-12-21 09:36:27 +00:00
Marc Herbert 53ce8b9d9f logger: new relative timestamps option, relative to first entry seen
Add a new sof-logger -e 0/1 relative timestamps option where the
TIMESTAMP column is relative to the first entry seen.

Removes many digits and makes the TIMESTAMP column much more readable in
short logs.

Also stop showing "NaN" as the first DELTA like something went
wrong. Show zero instead.

The new option is off by default when using -r(aw) and on otherwise.

The first entry is kept always absolute.

Before:

         TIMESTAMP              DELTA C# COMPONENT     LOCATION                      CONTENT
[6653843012.343750] (             NaN) c0 dma-trace    src/trace/dma-trace.c:339     ERROR FW ...
[6653843111.510417] (       99.166664) c0 ll-schedule  ./schedule/ll_schedule.c:229  perf ll_work
[6653843309.010417] (      197.500000) c0 ll-schedule  ./schedule/ll_schedule.c:399  task add
[6653843314.166667] (        5.156250) c0 ll-schedule  ./schedule/ll_schedule.c:403  task params
[6653843322.031250] (        7.864583) c0 ll-schedule  ./schedule/ll_schedule.c:309  new added
[6653843327.031250] (        5.000000) c0 ll-schedule  ./schedule/ll_schedule.c:312  num_tasks 2
[6653844109.531250] (      782.500000) c0 sa                    src/lib/agent.c:65   perf sys_load
[6653844155.156250] (       45.625000) c0 ll-schedule  ./schedule/ll_schedule.c:229  perf ll_work
[6653844384.218750] (      229.062500) c0 component       src/audio/component.c:130  comp new host

After:

         TIMESTAMP              DELTA C# COMPONENT     LOCATION                      CONTENT
[686125142.395834] (        0.000000) c0 dma-trace    src/trace/dma-trace.c:339     ERROR FW ...
[       94.270833] (       94.270836) c0 ll-schedule   ./schedule/ll_schedule.c:229  perf ll_work
[      296.770833] (      202.500000) c0 ll-schedule   ./schedule/ll_schedule.c:399  task add
[      301.979167] (        5.208333) c0 ll-schedule   ./schedule/ll_schedule.c:403  task params
[      309.843750] (        7.864583) c0 ll-schedule   ./schedule/ll_schedule.c:309  new added
[      314.843750] (        5.000000) c0 ll-schedule   ./schedule/ll_schedule.c:312  num_tasks 2
[     1092.395833] (      777.552063) c0 sa                     src/lib/agent.c:65   perf sys_load
[     1137.968750] (       45.572918) c0 ll-schedule   ./schedule/ll_schedule.c:229  perf ll_work
[     1850.208333] (      712.239563) c0 component        src/audio/component.c:130  comp new host

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2021-04-02 13:35:48 +01:00
Artur Kloniecki 5b29dae9c8 logger: Create global convert_config variable to avoid spaghetti code.
Most functions in logger depend on values stored in conver_config struct
which are passed to almost all function calls. This patch moves pointer
to the config to global context and allows each function to derive
necessary values from there. This reduces needless parameters passed
to function calls and allows for more flexible access to data in nested
functions.

Signed-off-by: Artur Kloniecki <arturx.kloniecki@linux.intel.com>
2020-09-01 10:11:55 +01:00
Karol Trzcinski bd0e10d133 logger: Store filter config given in command line
To parse filter configuration given by user, uuid dictionary
must be readed first from ldc file. Otherwise it's impossible
to validate given components names. This is reason why filter
configuration must be buffered and parsed in later steps.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-25 13:09:38 +01:00
Karol Trzcinski 7e7829d26f logger: Extract function for conversion between UUID value and UUID key
This conversion should be done in function, because of future usage
in different places, outside converter.c file.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-08-25 13:09:38 +01:00
Karol Trzcinski cb10221109 logger: Rename float_precision to time_precision
New name better describes variable functionality.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-06-24 09:30:26 +01:00
Karol Trzcinski d7b535e282 logger: Add option to set timestamp precision
Shorten timestamp makes logger output more compact, it change:
$ ./sof-logger -l sof-cnl.ldc -i dma_trace_1.bin
         TIMESTAMP              DELTA C# COMPONENT          LOCATION                      CONTENT
[   497588.489583] (   497588.500000) c0 DMA                .../intel/cavs/hda-dma.c:407  hda-dmac: 4 channel 6 -> get
to:
$ sof-logger -l sof-cnl.ldc -i dma_trace_1.bin -f0
   TIMESTAMP        DELTA C# COMPONENT          LOCATION                      CONTENT
[    497588] (    497588) c0 DMA                .../intel/cavs/hda-dma.c:407  hda-dmac: 4 channel 6 -> get

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-05-18 12:06:51 +01:00
Karol Trzcinski 5469b1a070 logger: Add option to cutout trace location
It allows to make logs output more compact, it change:
$ ./sof-logger -l sof-cnl.ldc -i dma_trace_1.bin
         TIMESTAMP              DELTA C# COMPONENT          LOCATION                      CONTENT
[   497588.489583] (   497588.500000) c0 DMA                .../intel/cavs/hda-dma.c:407  hda-dmac: 4 channel 6 -> get
to:
$ ./sof-logger -l sof-cnl.ldc -i dma_trace_1.bin -L
         TIMESTAMP              DELTA C# COMPONENT          CONTENT
[   497588.489583] (   497588.500000) c0 DMA                hda-dmac: 4 channel 6 -> get

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-05-18 12:06:51 +01:00
Karol Trzcinski f87c6e89f2 smex: logger: Logger should point to smex as ldc generator
rimage will not be responsible for ldc file creation so logger
should points valid tool.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-04-03 16:27:04 +01:00
Karol Trzcinski fc84534247 tools: logger: Add LDC dump option
Create dump options for logger to print important information from
LDC file, like DBG_ABI version and UUID with corresponding names.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
2020-03-26 10:18:30 +01:00
Marcin Maka 93cf630d9d logger: support for uuid address as entry parameter
Log entry format is scanned by the logger and if %s is found,
then corresponding parameter is interpreted as address
of static uuid entry. The original address is replaced by
formatted uuid namen and value, painted in blue, before
fprintf() is called.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2020-03-06 10:15:04 +01:00
Marcin Maka 11744cc588 logger: improve the format of the output
Log entry parameters format is compacted to reserve more
space for the text.

Max entry location length is increased to 24 characters.

Timestamp and component name/id use colors to improve
readability.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2020-03-06 10:15:04 +01:00
Marcin Maka 19e11c6e23 tools: add support for static uuids section
Content of static uuid section is appended to the ldc file
along with a new special header by rimage.

New ldc file part is read by the logger to decode
uuid pointers provided in traces into nice names.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2020-03-06 10:15:04 +01:00
Janusz Jankowski 3d5cc36b1b trace: deduplicate TRACE_CLASS defines
These traces shouldn't be duplicated, they should be in
more public header because they are used outside of FW.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-07-24 22:33:25 +02:00
ArturX Kloniecki 3e3f1d0cae Logger: Update license info in sof-looger files.
Signed-off-by: ArturX Kloniecki <arturx.kloniecki@linux.intel.com>
2019-05-31 22:26:31 +02:00
Janusz Jankowski e39ed5ebf4 include: split uapi headers into more directories
Some of interface headers are not needed by kernel,
but are needed by user-space applications, so we can split them
into multiple directories that indicate their purpose.

Signed-off-by: Janusz Jankowski <janusz.jankowski@linux.intel.com>
2019-05-31 20:10:45 +01:00
Marcin Maka ad0ff1f2e5 tools: logger: added less formatted output mode
Activated by '-r' option. Useful for intermediate log
processing when the output is used as an input for another
tool. No headers, tokens separated by single spaces,
component ids concatenated with component name to
still produce a single token if present.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2019-04-01 11:37:57 +02:00
Guennadi Liakhovetski 64bbee865b logger: support reading from a serial port
On some systems the DSP has no DMA interface to the host and is
using a serial port for sending its trace. This patch adds a "-u"
argument to specify a baudrate, that should be used with the serial
interface. The implementation takes care of spurious bytes,
sometimes seen in the beginning of the trace, produced by the port
initialisation by the DSP. The format is fixed to 8N1.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-01-11 11:44:21 +00:00
Guennadi Liakhovetski 28039d3024 logger: (cosmetic) fix the return value, use pointers
1. Programs shouldn't exit with negative return values, strictly
   speaking only EXIT_SUCCESS and EXIT_FAILURE should be used,
   however it is also valid to return 0 for success and any number
   from 1 to 125 for a failure.
2. Avoid passing complete structs as function parameters where an
   additional copy of one isn't needed, use const pointers instead.
3. Remove a left-over unused argument.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
2019-01-11 11:44:21 +00:00
Marcin Maka 95a3d93bbd tools: logger: turn off colors if the output file is not a tty.
Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
2018-12-04 13:37:16 +00:00
Bartosz Kokoszko 93f1a2eaa7 logger: include file_format.h directly from rimage
Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2018-11-27 10:43:06 +01:00
Bartosz Kokoszko 159cea157f tools: logger: removed uapi dependency
Logger now includes uapi directly from FW code.

Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
2018-11-26 18:06:26 +01:00
Curtis Malainey 5b5888ce07 Move SOFT into sub folder for SOF merge
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
2018-11-24 23:27:24 -08:00