From d7bce5145bb852a9cf439326bb33e5a142b6a2e1 Mon Sep 17 00:00:00 2001 From: Roman Romanchenko Date: Mon, 11 Feb 2019 12:43:24 +0200 Subject: [PATCH] TT#52455 sems-* constant 10% CPU usage in idle Virtual environment vagrant/vmware - DBRegagent loop sleep replaced with waitForEvent() call Change-Id: I525b635442a16a00aca0e3fa5444b02393d9b1fe --- debian/patches/series | 1 + debian/patches/sipwise/tt52455.patch | 37 ++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 debian/patches/sipwise/tt52455.patch diff --git a/debian/patches/series b/debian/patches/series index 8ff011d1..1f3131bc 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ +sipwise/tt52455.patch upstream/0000-b-f-sbc-fixed-reading-encoding-param-in-readPayload.patch upstream/0001-b-f-sbc-codecs-compare-encoding_param-only-if-both-0.patch upstream/0002-core-codec-init-support-for-fmt-params-negotiation-f.patch diff --git a/debian/patches/sipwise/tt52455.patch b/debian/patches/sipwise/tt52455.patch new file mode 100644 index 00000000..5d8b17b9 --- /dev/null +++ b/debian/patches/sipwise/tt52455.patch @@ -0,0 +1,37 @@ +--- a/apps/db_reg_agent/DBRegAgent.cpp ++++ b/apps/db_reg_agent/DBRegAgent.cpp +@@ -897,9 +897,8 @@ void DBRegAgent::run() { + DBG("running DBRegAgent thread...\n"); + shutdown_finished = false; + while (running) { ++ waitForEventTimed(500); // 500 milliseconds + processEvents(); +- +- usleep(1000); // 1ms + } + + DBG("DBRegAgent done, removing all registrations from Event Dispatcher...\n"); +--- a/core/AmEventQueue.cpp ++++ b/core/AmEventQueue.cpp +@@ -100,6 +100,11 @@ void AmEventQueue::waitForEvent() + ev_pending.wait_for(); + } + ++void AmEventQueue::waitForEventTimed(unsigned long msec) ++{ ++ ev_pending.wait_for_to(msec); ++} ++ + void AmEventQueue::processSingleEvent() + { + m_queue.lock(); +--- a/core/AmEventQueue.h ++++ b/core/AmEventQueue.h +@@ -80,6 +80,7 @@ public: + void postEvent(AmEvent*); + void processEvents(); + void waitForEvent(); ++ void waitForEventTimed(unsigned long msec); + void processSingleEvent(); + bool eventPending(); +