From patchwork Mon Jun 23 10:14:30 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: 32344 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f198.google.com (mail-vc0-f198.google.com [209.85.220.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5B99A203AC for ; Mon, 23 Jun 2014 10:14:48 +0000 (UTC) Received: by mail-vc0-f198.google.com with SMTP id hy10sf21825297vcb.9 for ; Mon, 23 Jun 2014 03:14:48 -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=8mCcM8AnSBzPEJ8hBNvZDYKjQAKdOEbrGmJaZ3bUg5Q=; b=McxJBiiNsXRjspZcbqsvjtZQIgYR4vI+wQJsic4NXMbZ8sEnNGF9g23ECjW5ku5eie lW6omct3kG5VU9mCyYclCyERfydoi0+M5dKZy6gl/5eWjaCYq8kTqwiKRPsGWPRI+/zU UYs1/wjapkcL97NKDO0LjXMDIY4bWd9gSjMo+qre8s9CHHuhVONVwCYQaDVdzooLi+B3 Dwqka5oUr/4qSBE8UhGvlWU1J316/RYhsLN1lJBwHuWKmZT91qpegEj5e9DFZWIbPKJe XLvVVkP4RiSexa/RU5X33WM3pITQb/s3FvWlDypCh3VnLJHdc5K3US/I4gRPIK/OrI7A gUsA== X-Gm-Message-State: ALoCoQkFw7Omh1hkDqLHQWk5X6ZuLdw/6HJuIOwPVT6h7vV6tLgd2rXQpic3FzvoD+XZvafnQkMm X-Received: by 10.236.189.68 with SMTP id b44mr8240731yhn.4.1403518488080; Mon, 23 Jun 2014 03:14:48 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.84.72 with SMTP id k66ls1861469qgd.96.gmail; Mon, 23 Jun 2014 03:14:48 -0700 (PDT) X-Received: by 10.221.20.199 with SMTP id qp7mr18439203vcb.24.1403518488005; Mon, 23 Jun 2014 03:14:48 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id j8si8702060vcr.60.2014.06.23.03.14.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Jun 2014 03:14:47 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id id10so5653508vcb.24 for ; Mon, 23 Jun 2014 03:14:47 -0700 (PDT) X-Received: by 10.58.1.9 with SMTP id 9mr18939239vei.14.1403518487944; Mon, 23 Jun 2014 03:14:47 -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 tc5csp119329vcb; Mon, 23 Jun 2014 03:14:47 -0700 (PDT) X-Received: by 10.68.111.2 with SMTP id ie2mr27759738pbb.97.1403518487124; Mon, 23 Jun 2014 03:14:47 -0700 (PDT) Received: from mail-pa0-f53.google.com (mail-pa0-f53.google.com [209.85.220.53]) by mx.google.com with ESMTPS id st6si21293275pab.46.2014.06.23.03.14.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Jun 2014 03:14:47 -0700 (PDT) Received-SPF: pass (google.com: domain of sanjay.rawat@linaro.org designates 209.85.220.53 as permitted sender) client-ip=209.85.220.53; Received: by mail-pa0-f53.google.com with SMTP id ey11so5697654pad.40 for ; Mon, 23 Jun 2014 03:14:46 -0700 (PDT) X-Received: by 10.68.102.34 with SMTP id fl2mr27169572pbb.2.1403518486604; Mon, 23 Jun 2014 03:14:46 -0700 (PDT) Received: from srawat-Latitude-E6420.LGE.NET ([203.247.149.152]) by mx.google.com with ESMTPSA id pl10sm26109416pbb.56.2014.06.23.03.14.43 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 23 Jun 2014 03:14:46 -0700 (PDT) From: Sanjay Singh Rawat To: vincent.guittot@linaro.org, christian.muller@linaro.org Cc: Sanjay Singh Rawat Subject: [PATCH RTAPP V3] add delay param in thread parameters Date: Mon, 23 Jun 2014 15:44:30 +0530 Message-Id: <1403518470-13920-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.220.179 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 --- 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 | 5 +++-- src/rt-app_parse_config.c | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/rt-app.c b/src/rt-app.c index fdde1bd..0b67912 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,13 +458,13 @@ 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 { + } else if (!tdata->wait_before_start && !opts.spacing){ tdata->wait_before_start = 0; } tdata->duration = opts.duration; 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);