This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Tune reader_thread poll timeout value


Hi,

I am following-up remark made in the context of "Making the transport layer more robust" topic. Goal is to reduce number of systemtap wake-ups in the context of embedded low-power use cases like MP3 playback.
The last non tunable or small duration source of wake-up is "reader_thread" ppoll timeout value, every 200ms. We compile systemtap with a value of 2s or more for our daily use.

So I am proposing to introduce tunables below as an example. Don't know if I should have correlated s and ns, also don't know if this should also be applied to relay_old.c. Please tell me if this is an acceptable change:


From 3fac053713be44c00e05423b4f31e2ed8edaa993 Mon Sep 17 00:00:00 2001
From: Frederic Turgis <f-turgis@ti.com>
Date: Wed, 2 May 2012 01:16:28 +0200
Subject: [PATCH] Make reader_thread poll timeout tunable at compilation

---
 runtime/staprun/relay.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/runtime/staprun/relay.c b/runtime/staprun/relay.c
index e08ff60..d81a45f 100644
--- a/runtime/staprun/relay.c
+++ b/runtime/staprun/relay.c
@@ -12,6 +12,13 @@

 #include "staprun.h"

+#ifndef STP_RELAY_TIMEOUT_S
+#define STP_RELAY_TIMEOUT_S 0
+#endif
+#ifndef STP_RELAY_TIMEOUT_NS
+#define STP_RELAY_TIMEOUT_NS 200000000
+#endif
+
 int out_fd[NR_CPUS];
 static pthread_t reader[NR_CPUS];
 static int relay_fd[NR_CPUS];
@@ -125,7 +132,7 @@ static void *reader_thread(void *data)
         char buf[131072];
         int rc, cpu = (int)(long)data;
         struct pollfd pollfd;
-       struct timespec tim = {.tv_sec=0, .tv_nsec=200000000}, *timeout = &tim;
+       struct timespec tim = {.tv_sec=STP_RELAY_TIMEOUT_S, .tv_nsec=STP_RELAY_TIMEOUT_NS}, *timeout = &tim;
        sigset_t sigs;
        off_t wsize = 0;
        int fnum = 0;
--

Regards
FRed

OMAP Platform Business Unit - System Platform Engineering - Platform & Product Entitlement



Texas Instruments France SA, 821 Avenue Jack Kilby, 06270 Villeneuve Loubet. 036 420 040 R.C.S Antibes. Capital de EUR 753.920



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]