Skip to content

Commit

Permalink
CRAS: audio_thread_monitor - rarefy audio thread event FRA
Browse files Browse the repository at this point in the history
Audio thread event could be triggered easily and repeatedly
resulting the corresponding FRA log to cause potential syslog spam.
To mitigate this, relocate the FRA logging to occur after the
30-seconds guard period. This ensures that FRA logs coinside
with the snapshots taken in audio thread.

BUG=b:311159629
TEST=None

Change-Id: I9515a10882ce191210c790f5164ddfd4e765aa93
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/5036005
Tested-by: Hsinyu Chao <hychao@chromium.org>
Commit-Queue: Hsinyu Chao <hychao@chromium.org>
Tested-by: chromeos-cop-builder@chromeos-cop.iam.gserviceaccount.com <chromeos-cop-builder@chromeos-cop.iam.gserviceaccount.com>
Reviewed-by: Judy Hsiao <judyhsiao@google.com>
  • Loading branch information
Hsin-yu Chao authored and Chromeos LUCI committed Nov 17, 2023
1 parent ce1c4dc commit 3114bc3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cras/src/server/cras_audio_thread_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@ static void handle_audio_thread_event_message(struct cras_main_message* msg,
return;
}

FRALOG(
AudioThreadEvent,
{"type", audio_thread_event_type_to_str(audio_thread_msg->event_type)});

struct timespec* last_snapshot_time =
&last_event_snapshot_time[audio_thread_msg->event_type];

Expand All @@ -143,6 +139,10 @@ static void handle_audio_thread_event_message(struct cras_main_message* msg,
subtract_timespecs(&now_time, last_snapshot_time, &diff_time);
if (timespec_is_zero(last_snapshot_time) ||
diff_time.tv_sec >= MIN_WAIT_SECOND) {
FRALOG(
AudioThreadEvent,
{"type", audio_thread_event_type_to_str(audio_thread_msg->event_type)});

take_snapshot(audio_thread_msg->event_type);
*last_snapshot_time = now_time;
}
Expand Down

0 comments on commit 3114bc3

Please sign in to comment.