-
-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support payload argument separation similar to DltViewer #10
base: master
Are you sure you want to change the base?
Conversation
Thx! :-) |
@@ -95,6 +95,7 @@ This extension contributes the following settings: | |||
* `dlt-logs.fileExtensions`: Specifies the file extensions to use for file open dialog. Defaults to .dlt|.DLT. | |||
* `dlt-logs.maxNumberLogs`: Specified the maximum number of DLT logs that get displayed in one page. If more logs exist - considering the active filters - a paging mechanism is in place that starts rendering a new page at 4/5th of the page boundary. Searching is limited to the visible page. Defaults to 0.4mio logs. Depending on your machines performance/RAM you might reduce/increase this. Best case is to find a limit/config where all logs fit into that range (use filter!). | |||
* `dlt-logs.reReadTimeout`: Specified the timeout in ms after opening the file before starting to parse the dlt file. If the file doesn't open, increase this to e.g. 5s. | |||
* `dlt-logs.separatePayloadArgs`: Separate payload arguments with a space (' ') character. Default is false to not break existing filters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about reversing the logic? The target should be same output as dltviewer.
The problem are existing users that have filters with payload. We could introduce the flag as
"legacyPayloadDecoding", default false, at startup check whether there are existing filters with payload and ask/inform user to check his filters or enable the option?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In lights of your later comments regarding memory consumption etc. this is probably the better solution.
One question remains: How do you recognize "legacy" filters? It would be complete guesswork as especially the payload filter is in the end only a string regex. What would be the identifier?
Of the top of my head? Add a completely redundant version field to either the filter section or each filter. If the field is not available, show a message stating that there are maybe incompatible filters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, as soon as there is any filter with a payload/payloadregex I'd show the message and ask the user. Filters with ecu/apid/ctid,... are not impacted.
@@ -292,7 +295,7 @@ export class DltMsg { | |||
argOffset += 2; | |||
const rawd = this._payloadData.slice(argOffset, argOffset + lenRaw); | |||
this._payloadArgs.push({ type: Buffer, v: Buffer.from(rawd) }); // we make a copy here to avoid referencing the payloadData that we want to release/gc afterwards | |||
this._payloadText += rawd.toString("hex"); | |||
this._payloadText += rawd.toString("hex") + this.payloadArgSeparator; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's not the only place where the space is missing?
And: does dltviewer add a space at the end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard to tell.
Do you have an easy to use DLT example that uses all different DLT_LOG functions to write messages? Plus, I'm not really that good at reading the dltviewer code to answer that clearly.
What I would say: the current implementation, or rather, simply adding a space at this position did not seem to add additional spaces at the end in vscode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sadly I miss good examples. Could write a small test app that creates those.
I might have some code to remove whitespace at end ;-) (will take a look)
I can check the dltviewer code and try to understand the rules implemented there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see inline comments.
btw: I could configure the GitHub workflow to build a .vsix install package for PRs as well (to avoid the need to build locally)? |
uff. good question. You don't really see the formatting in dltviewer easily and I'm not good at reading the dltviewer source code to easily point to any possible differences.
Going out on a limb here: Yes, it does. Having an example dlt file using all possible argument combinations would be easier.
In the cases that I have seen there is a space after each arg with the last arg probably not being ended with a space.
One thing comes to mind: byte representation. In the current extension version, payload containing bytes are not split on byte size (0000 vs. 00 00). Apart from that... good question. |
533a73c
to
79cbc04
Compare
@@ -93,6 +93,7 @@ export class DltMsg { | |||
readonly timeAsNumber: number; // time in ms. Date uses more memory! | |||
get timeAsDate(): Date { return new Date(this.timeAsNumber); } | |||
|
|||
readonly payloadArgSeparator: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
readonly payloadArgSeparator: string; | |
static payloadArgSeparator = vscode.workspace.getConfiguration().get<boolean>('dlt-logs.legacyPayloadDecoding') ? "" : " "; // default behaviour of legacyPayloadDecoding is false, add a space character in that case. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could this work?
@@ -292,7 +295,7 @@ export class DltMsg { | |||
argOffset += 2; | |||
const rawd = this._payloadData.slice(argOffset, argOffset + lenRaw); | |||
this._payloadArgs.push({ type: Buffer, v: Buffer.from(rawd) }); // we make a copy here to avoid referencing the payloadData that we want to release/gc afterwards | |||
this._payloadText += rawd.toString("hex"); | |||
this._payloadText += rawd.toString("hex") + this.payloadArgSeparator; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this._payloadText += rawd.toString("hex") + this.payloadArgSeparator; | |
this._payloadText += rawd.toString("hex") + DltMsg.payloadArgSeparator; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as the consequence?
260cfc9
to
b6cf392
Compare
This is hopefully a fitting implementation for #9.
Adds a config item to specify if payload args should be separated or not; defaults to false.
Slight interface change required imho to support this payload separation.
Please note: I haven't installed a local build environment, so .. it could work. Probably not. First time typescripting...