-
Notifications
You must be signed in to change notification settings - Fork 297
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
trace-load: improve trace load lookup #688
base: master
Are you sure you want to change the base?
Conversation
8297782
to
d4b2bf7
Compare
quick side note on these changes: strncpy(daemon.preconfigured_trace_load_settings[0].apid, "APP0", DLT_ID_SIZE); while not strictly required with the compiler used in the pipeline it crashed locally with the following gcc version
|
d4b2bf7
to
15ed64f
Compare
Issue-ID: APRICOT-631667 Signed-off-by: Alexander Mohr <[email protected]>
15ed64f
to
182fbce
Compare
9ad49d8
to
70ce605
Compare
Signed-off-by: Alexander Mohr <[email protected]>
70ce605
to
fb8c315
Compare
Hi @alexmohr |
Hi @alexmohr |
Testing can be done the same as the original Pr. i can't provide better tests at the moment because I'm not in office until December. Using this approach is faster because this api is using qsearch instead of a linear search. Most improvements are on clients side though where total number of search operations are reduced drastically by storing the trace load limits in the context. |
dlt_find_runtime_trace_load_settings( | ||
dlt_ll_ts_type* ll_ts = &dlt_user.dlt_ll_ts[log->handle->log_level_pos]; | ||
if (ll_ts->trace_load_settings == NULL) { | ||
ll_ts->trace_load_settings = dlt_find_runtime_trace_load_settings( |
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.
The trace load settings should be check null before accessing
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.
Can you elaborate on this? Null check for tl settings is above and this if is only executed when it is null
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.
Do you mean checking ll_ts for null? I think that check would be superfluous
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.
After carefully checking, it is superfluous to check ll_ts->trace_load_settings null. Because this pointer already check null and print log inside func "dlt_check_trace_load"
@@ -162,7 +162,10 @@ typedef struct | |||
int user_handle; /**< connection handle for connection to user application */ | |||
char *context_description; /**< context description */ | |||
int8_t storage_log_level; /**< log level set for offline logstorage */ | |||
bool predefined; /**< set to true if this context is predefined by runtime configuration file */ | |||
bool predefined; |
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 you explain the purpose of removing the comment of the bool predefined variable? If it was removed intentionally, kindly please consider reverting this line if it is not necessary."
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.
Was not used as far I could tell, but maybe missed something?
@@ -1636,6 +1636,13 @@ int main(int argc, char *argv[]) | |||
dlt_gateway_deinit(&daemon_local.pGateway, daemon_local.flags.vflag); | |||
|
|||
dlt_daemon_free(&daemon, daemon_local.flags.vflag); | |||
#ifdef DLT_TRACE_LOAD_CTRL_ENABLE |
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.
Those lines of code should be warped in 1 function like "dlt_traceload_free"
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.
Will do, once I'm back in office in December :)
@@ -1308,6 +1306,15 @@ DltReturnValue dlt_register_app(const char *apid, const char *description) | |||
|
|||
#ifdef DLT_TRACE_LOAD_CTRL_ENABLE | |||
strncpy(trace_load_settings[0].apid, dlt_user.appID, DLT_ID_SIZE); | |||
if (!trace_load_context.contextID[0]) |
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.
It is make sense to register special context inside dlt_register_app. Because dlt_register_app api serve for register app purpose.
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.
It is required, as logging without calling the register api first is technically possible and is happening within our project and this change is implemented in a way that is fully compliant with existing code
@@ -1308,6 +1306,15 @@ DltReturnValue dlt_register_app(const char *apid, const char *description) | |||
|
|||
#ifdef DLT_TRACE_LOAD_CTRL_ENABLE | |||
strncpy(trace_load_settings[0].apid, dlt_user.appID, DLT_ID_SIZE); |
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.
strncpy(trace_load_settings[0].apid, dlt_user.appID, DLT_ID_SIZE); | |
pthread_rwlock_wrlock(&trace_load_rw_lock); | |
strncpy(trace_load_settings[0].apid, dlt_user.appID, DLT_ID_SIZE); | |
pthread_rwlock_unlock(&trace_load_rw_lock); |
Writing settings needs protection to prevent seg faults
Store trace load in context of doing a search on each message.
The increased load was detected by our performance team.
Please note that our internal version is not building on master but a previous release, thus I had to adjust the patch a little.
I wanted to upstream this change asap although it needs to go through some final verification on our end because it is a very important amendment to the existing implementation and should be a huge from a performance viewpoint.
@minminlittleshrimp Please review this and also give it a test in your setup.
I'll be on vacation starting at the end of next week, so response times will be a lot longer than usual and I won't be able to make changes before my return at the start of December.
Furthermore I will be switching Teams internally at the start of next year, so this might be one of my last contributions for some time.
It has been really fun working together with you :)
solves #685