Logger: added tool for parsing new trace format#77
Logger: added tool for parsing new trace format#77lgirdwood merged 2 commits intothesofproject:masterfrom
Conversation
| uint32_t *params; | ||
| }; | ||
|
|
||
| struct dma_log_header { |
There was a problem hiding this comment.
Is this a FW struct, if so we should include it from a header in uapi/
@bardliao is also making changes to the driver to use the kernel trace framework to output the tarce/log data. This means the format output will be the structure in ASCII HEX format.
There was a problem hiding this comment.
@lgirdwood Ok, but in what way can I include uapi headers existing in different repo? (sof)
There was a problem hiding this comment.
@bkokoszx the should be installed by "make install" rule from FW.
There was a problem hiding this comment.
I've included from "/usr/local/include/sof/uapi/logging.h"
| entry.file_name, | ||
| entry.header.line_idx); | ||
|
|
||
| switch(entry.header.params_num){ |
| switch(entry.header.params_num){ | ||
| case 0: | ||
| fprintf(stdout, "%s", entry.text); | ||
| break; |
| uint32_t base_address, | ||
| uint32_t data_offset, | ||
| struct dma_log dma_log) { | ||
|
|
There was a problem hiding this comment.
why the newlines within the variable declaration block ?
|
|
||
| /* fetching elf header params */ | ||
| ret = fread(&entry.header, sizeof(entry.header), 1, f_ldc); | ||
|
|
| /* fetching text */ | ||
| entry.text = (char *) malloc(entry.text_len); | ||
| if (entry.text == NULL) { | ||
| printf("Memory error."); |
There was a problem hiding this comment.
fprintf(stderr, "error: can't alocate %d bytes for XXX\n"); and for similar errors.
| return ret; | ||
| } | ||
|
|
||
| int main(int argc, char *argv[]) { |
| int ret; | ||
|
|
||
| if (argc < 3) { | ||
| printf("Error: Too few input arguments. \n"); |
There was a problem hiding this comment.
fprintf(stderr, etc...
this should also print the usage of logger including cmd line args.
| return -EINVAL; | ||
| } | ||
|
|
||
| const char *LDC_DIR = argv[1]; |
There was a problem hiding this comment.
This should be in one block above and lowercase
| @@ -0,0 +1,4 @@ | |||
| bin_PROGRAMS = logger | |||
There was a problem hiding this comment.
sof-logger as this will avoid namespace conflicts.
174554d to
957ee93
Compare
|
travis-ci was expected to fail. Sof should be installed ("make install") before building soft. |
|
@bkokoszx |
|
@xiulipan |
|
@lgirdwood |
|
@bkokoszx @lgirdwood Is it possible for you to remove the offending code from SOF if this work is not mature enough to be merged to kernel and SOFT. |
|
@lgirdwood |
|
@bkokoszx have you re-pushed the new updates. I can still see some changes related to errno that are missing. i.e. you are returning EINVAL when you should be returning errno. |
|
@lgirdwood |
|
@lgirdwood @bkokoszx |
| int ret; | ||
|
|
||
| const char *ldc_dir = argv[1]; | ||
| const char *dma_dump = argv[2]; |
There was a problem hiding this comment.
Can you take rmbox as reference to have use getopt for the function.
Or just replace the old rmbox.
while ((opt = getopt(argc, argv, "ho:i:s:m:c:t")) != -1) {
switch (opt) {
case 'o':
out_file = optarg;
break;
case 'i':
in_file = optarg;
break;
case 't':
trace = 1;
break;
case 'c':
clk = atof(optarg);
break;
case 's':
return snapshot(optarg);
case 'h':
default: /* '?' */
usage(argv[0]);
}
}There was a problem hiding this comment.
@bkokoszx yes pls use getopt, no need to replace rmbox atm as we need it for legacy. I want to merge this PR today.
|
To handle fread I use following code: |
Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
Signed-off-by: Bartosz Kokoszko <bartoszx.kokoszko@linux.intel.com>
|
@lgirdwood |
|
@bkokoszx one more change that can be done incrementally is to use relative path for uapi/logger.h i.e. include <sof/uapi/logger.h> |
|
Synchronization through version matching in the ABI? |
|
Yes, we would need some version data. @bkokoszx can you add versioning support here and we can duplicate the header. |
|
@lgirdwood @bkokoszx regarding header duplication in developement. And when you checkout both sof and soft inside of it, then you can freely change between branches/commits of both sof and soft. If you want to check if logger from soft revision Or we could do this the other way around. If you want to check if logger from soft revision And without populating submodule, only copying file or symlinking file
Regading how to make |
|
@mwierzbix @lgirdwood @bkokoszx Another solution to this could be moving logger itself to the FW repository (As was done with rimage). Since then we will have a complete package after building (FW and application to translate logs). |
|
@mmaka1 any objections to merging soft -> sof repo ? This would make CI easier too for working topologies since they would be aligned with FW. @cujomalainey would merging repos be OK for you ? |
|
Would it be just the tools migrated or the topologies as well? Either should be fine, I don't see any reason why that would be an issue over here. We will just need to update the scripts and docker system once the change is done. |
|
@cujomalainey everything over, tools and topologies. |
|
@lgirdwood I am Ok with this simplification. |
|
@lgirdwood What is your opinion about using git-submodule mentioned by @mwierzbix? |
|
@bkokoszx @lgirdwood Some pretty solid articles in the subject: |
|
Just make sure everyone understands to run |
|
@cujomalainey Hmm, you suggest README.md or maybe get-sof.sh? |
|
I would do a readme personally. Git submodules are pretty easy once you get over the short learning curve. The script would add to the confusion in my opinion. |
I've added tool for parsing new trace format.
As input tool gets two files:
Tool throws parsed logs to stdout.