+#define _GNU_SOURCE
+
#include "wakeup_audio_manager.h"
#include "wakeup_manager_main.h"
#include "dependency_resolver.h"
#include "heap_tracer.h"
+#include <sys/time.h>
+#include <sys/resource.h>
+
#include <algorithm>
#include <Ecore.h>
{
long long delta = mAudioRecordingDurationMilliseconds;
- notify_audio_data_recording(time, data.buffer, data.len);
-
- mas_speech_data_with_time data_with_time;
- data_with_time.data = data;
- data_with_time.time = time;
-
+ bool print_log = false;
static unsigned int num = 0;
const std::chrono::seconds interval(3);
static auto last = std::chrono::steady_clock::now();
auto now = std::chrono::steady_clock::now();
+
+ struct rusage process_usage_before;
+ struct rusage thread_usage_before;
+
if (now - last > interval) {
- MWR_LOGE("Feeding audio data : num(%d), now(%" PRId64 "), %d %zu",
- num, now.time_since_epoch().count(),
- mStreamingThreadActive.load(), mAudioData.size());
+ print_log = true;
last = now;
+ getrusage(RUSAGE_SELF, &process_usage_before);
+ getrusage(RUSAGE_THREAD, &thread_usage_before);
}
num++;
+ notify_audio_data_recording(time, data.buffer, data.len);
+
+ if (print_log) {
+ struct rusage process_usage_after;
+ struct rusage thread_usage_after;
+
+ getrusage(RUSAGE_SELF, &process_usage_after);
+ getrusage(RUSAGE_THREAD, &thread_usage_after);
+
+ MWR_LOGE("Feeding audio data : num(%d), now(%" PRId64 "), %d %zu ([%ld,%ld,%ld,%ld] -> [%ld,%ld,%ld,%ld]) ([%ld,%ld,%ld,%ld] -> [%ld,%ld,%ld,%ld])",
+ num, now.time_since_epoch().count(),
+ mStreamingThreadActive.load(), mAudioData.size(),
+ process_usage_before.ru_maxrss,
+ process_usage_before.ru_ixrss,
+ process_usage_before.ru_idrss,
+ process_usage_before.ru_isrss,
+ process_usage_after.ru_maxrss,
+ process_usage_after.ru_ixrss,
+ process_usage_after.ru_idrss,
+ process_usage_after.ru_isrss,
+ thread_usage_before.ru_maxrss,
+ thread_usage_before.ru_ixrss,
+ thread_usage_before.ru_idrss,
+ thread_usage_before.ru_isrss,
+ thread_usage_after.ru_maxrss,
+ thread_usage_after.ru_ixrss,
+ thread_usage_after.ru_idrss,
+ thread_usage_after.ru_isrss);
+ }
+
+ mas_speech_data_with_time data_with_time;
+ data_with_time.data = data;
+ data_with_time.time = time;
+
lock_guard<mutex> lock(mMutex);
/* Pop items only when the streaming is not activated */