This is the mail archive of the 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


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 <>
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"

+#define STP_RELAY_TIMEOUT_NS 200000000
 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;


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]