From patchwork Mon Jun 23 13:28:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sanjay Singh Rawat X-Patchwork-Id: 32351 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f197.google.com (mail-ob0-f197.google.com [209.85.214.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C1B4F20540 for ; Mon, 23 Jun 2014 13:28:37 +0000 (UTC) Received: by mail-ob0-f197.google.com with SMTP id uz6sf23152165obc.8 for ; Mon, 23 Jun 2014 06:28:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=GMu8ONWGg7xi+4GORDE0pQKQrP1AW8bbzlv7UkTPQHc=; b=FF+3vV0HvLMyIMXUaV6XW+NOS1UfW/zig8iIqOQnFaARgj4KkpRxJNt4loaaCn4UYT esL345Y2iokw+FOIgEvZ13i0zvnRFQB8qRPW7bc6n2thEcDMY67Ova5iUWUsK93ixJ8Z q9qAUuC50QJVtIZAmqkL5cBHdMLawq1ECayMF4nYrXLRPLPPUtYFoTdtTWKEAkX3zufp I3YdpNznniy6rwea7K0Mc0rnQojmH4lBgCcSZxssi08qWAP5FVC09Z7kBg1WW8atPkaJ XyzVRjEbI0HlYCyffZIaXs7ZDwdINI1lLeXL2JYa37ZzdOfz80QOgj8HcvYkD4a3Q9bT 220g== X-Gm-Message-State: ALoCoQlJoSNTjDiHdPsBmYhllBmWfrpWXNwJU6rQ2v2IA1kNs2FICn4igsUmhmWRUZAbwjc9wdOe X-Received: by 10.182.109.231 with SMTP id hv7mr9776608obb.2.1403530117379; Mon, 23 Jun 2014 06:28:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.37.18 with SMTP id q18ls1353162qgq.70.gmail; Mon, 23 Jun 2014 06:28:37 -0700 (PDT) X-Received: by 10.58.141.168 with SMTP id rp8mr1523747veb.40.1403530117252; Mon, 23 Jun 2014 06:28:37 -0700 (PDT) Received: from mail-ve0-f175.google.com (mail-ve0-f175.google.com [209.85.128.175]) by mx.google.com with ESMTPS id br4si8976820vcb.106.2014.06.23.06.28.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Jun 2014 06:28:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.175 as permitted sender) client-ip=209.85.128.175; Received: by mail-ve0-f175.google.com with SMTP id jx11so6103786veb.34 for ; Mon, 23 Jun 2014 06:28:37 -0700 (PDT) X-Received: by 10.52.23.71 with SMTP id k7mr14286939vdf.27.1403530117192; Mon, 23 Jun 2014 06:28:37 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp130671vcb; Mon, 23 Jun 2014 06:28:36 -0700 (PDT) X-Received: by 10.68.203.132 with SMTP id kq4mr29257866pbc.12.1403530116333; Mon, 23 Jun 2014 06:28:36 -0700 (PDT) Received: from mail-pd0-f178.google.com (mail-pd0-f178.google.com [209.85.192.178]) by mx.google.com with ESMTPS id ka6si21911845pbc.153.2014.06.23.06.28.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Jun 2014 06:28:36 -0700 (PDT) Received-SPF: pass (google.com: domain of sanjay.rawat@linaro.org designates 209.85.192.178 as permitted sender) client-ip=209.85.192.178; Received: by mail-pd0-f178.google.com with SMTP id r10so5729507pdi.9 for ; Mon, 23 Jun 2014 06:28:35 -0700 (PDT) X-Received: by 10.68.186.130 with SMTP id fk2mr28951623pbc.60.1403530115608; Mon, 23 Jun 2014 06:28:35 -0700 (PDT) Received: from srawat-Latitude-E6420.LGE.NET ([203.247.149.152]) by mx.google.com with ESMTPSA id bv4sm93712383pad.25.2014.06.23.06.28.31 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Jun 2014 06:28:34 -0700 (PDT) From: Sanjay Singh Rawat To: vincent.guittot@linaro.org, christian.muller@linaro.org Cc: Sanjay Singh Rawat Subject: [PATCH RTAPP V4] add delay param in thread parameters Date: Mon, 23 Jun 2014 18:58:18 +0530 Message-Id: <1403530098-18333-1-git-send-email-sanjay.rawat@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: sanjay.rawat@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.175 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , to start thread after a certain amount of time, add delay option in the json file in microseconds --- V4: remove multiple setting of wait_before_start V3: make use of wait_before_start to store the delay param specified in task property V2: this is an update on the previous patch, handling the comments - make delay as usec instead of using the nano sec structure - make thread delay & spacing mutually exclusive this patch is based on 17be4548 --- src/rt-app.c | 6 +++--- src/rt-app_parse_config.c | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/rt-app.c b/src/rt-app.c index fdde1bd..6682fe2 100644 --- a/src/rt-app.c +++ b/src/rt-app.c @@ -262,6 +262,7 @@ void *thread_body(void *arg) NULL); log_notice("[%d] Starting...", data->ind); } + /* if we know the duration we can calculate how many periods we will * do at most, and the log to memory, instead of logging to file. */ @@ -457,15 +458,14 @@ int main(int argc, char* argv[]) for (i = 0; i < nthreads; i++) { tdata = &opts.threads_data[i]; - if (opts.spacing > 0 ) { + if (!tdata->wait_before_start && (opts.spacing > 0)) { /* start the thread, then it will sleep accordingly * to its position. We don't sleep here anymore as * this would mean that * duration = spacing * nthreads + duration */ tdata->wait_before_start = opts.spacing * (i+1); - } else { - tdata->wait_before_start = 0; } + tdata->duration = opts.duration; tdata->main_app_start = t_start; tdata->lock_pages = opts.lock_pages; diff --git a/src/rt-app_parse_config.c b/src/rt-app_parse_config.c index f7f8056..2e9e121 100644 --- a/src/rt-app_parse_config.c +++ b/src/rt-app_parse_config.c @@ -389,6 +389,9 @@ parse_thread_data(char *name, struct json_object *obj, int idx, exit(EXIT_INV_CONFIG); } data->deadline = usec_to_timespec(dline); + + /* delay */ + data->wait_before_start = get_int_value_from(obj, "delay", TRUE, 0); /* cpu set */ cpuset_obj = get_in_object(obj, "cpus", TRUE);