From patchwork Fri Jul 24 13:31:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 51447 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f198.google.com (mail-wi0-f198.google.com [209.85.212.198]) by patches.linaro.org (Postfix) with ESMTPS id 841A720323 for ; Fri, 24 Jul 2015 13:33:27 +0000 (UTC) Received: by wixh2 with SMTP id h2sf7016228wix.0 for ; Fri, 24 Jul 2015 06:33:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:delivered-to:from:to:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :mime-version:content-type:content-transfer-encoding:errors-to :sender:x-original-sender:x-original-authentication-results :mailing-list; bh=lzPA6fPhhb3vr7+TAu/JSAfA8OgwX8VX834yzUXZ5Bc=; b=gLvnGhNmSjJQxjYc9OKahpcUVBS6ZhAMFzZDkfJHrlV7imrtmDE0cYPXuiNmyfoc5c 5iYaXtGJyHwnO/Eqi7XyYgdmEaD7O1WUyzlU1VvJ58dw3VNaRCXAGbbAvamNwSDBM9JN 2FzD163TZqAi92j40ih05X8nODqiT6TYkAZLiT6i9T082N0OrynqDGzKaVVdepczPC+G 4CadVAVKUenruNr6SvgNnBHZrSOjsmMua2rwZ0KJy0l7n1x7yiUnolUAKkyd1u2YJbVw k7GUqIIxSgRylVEZLUNw0Tvbhkq4GrGp1uIjWDaQdYv6tT70M5Yukkrz+jCVbhgNk1cl JgYw== X-Gm-Message-State: ALoCoQke3WOfdExPukqcAB79eovxSvN11wEl6ygV71MSR8qOsqmG2ip7QphSfuLjl90LQPs6Zgci X-Received: by 10.194.179.42 with SMTP id dd10mr6210360wjc.7.1437744806876; Fri, 24 Jul 2015 06:33:26 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.30.36 with SMTP id p4ls392809lah.63.gmail; Fri, 24 Jul 2015 06:33:26 -0700 (PDT) X-Received: by 10.152.42.174 with SMTP id p14mr4288317lal.48.1437744806699; Fri, 24 Jul 2015 06:33:26 -0700 (PDT) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com. [209.85.217.182]) by mx.google.com with ESMTPS id nx8si7530336lbb.161.2015.07.24.06.33.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jul 2015 06:33:26 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.182 as permitted sender) client-ip=209.85.217.182; Received: by lblf12 with SMTP id f12so15319631lbl.2 for ; Fri, 24 Jul 2015 06:33:26 -0700 (PDT) X-Received: by 10.152.37.228 with SMTP id b4mr13597965lak.117.1437744806342; Fri, 24 Jul 2015 06:33:26 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp1187301lba; Fri, 24 Jul 2015 06:33:25 -0700 (PDT) X-Received: by 10.140.235.132 with SMTP id g126mr21592200qhc.101.1437744804911; Fri, 24 Jul 2015 06:33:24 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id k77si10013924qhc.70.2015.07.24.06.33.23; Fri, 24 Jul 2015 06:33:24 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id 0599361B50; Fri, 24 Jul 2015 13:33:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from ip-10-142-244-252.ec2.internal (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 5215E61B51; Fri, 24 Jul 2015 13:32:14 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 28C2861845; Fri, 24 Jul 2015 13:31:59 +0000 (UTC) Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com [209.85.212.169]) by lists.linaro.org (Postfix) with ESMTPS id E9E126182D for ; Fri, 24 Jul 2015 13:31:55 +0000 (UTC) Received: by wibxm9 with SMTP id xm9so28244224wib.1 for ; Fri, 24 Jul 2015 06:31:55 -0700 (PDT) X-Received: by 10.194.184.140 with SMTP id eu12mr26175505wjc.78.1437744715192; Fri, 24 Jul 2015 06:31:55 -0700 (PDT) Received: from khorivan.synapse.com (104.46.77.93.pool.smart.vn.ua. [93.77.46.104]) by smtp.gmail.com with ESMTPSA id df1sm3569097wib.12.2015.07.24.06.31.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Jul 2015 06:31:54 -0700 (PDT) From: Ivan Khoronzhuk To: lng-odp@lists.linaro.org Date: Fri, 24 Jul 2015 16:31:34 +0300 Message-Id: <1437744694-8615-3-git-send-email-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1437744694-8615-1-git-send-email-ivan.khoronzhuk@linaro.org> References: <1437744694-8615-1-git-send-email-ivan.khoronzhuk@linaro.org> X-Topics: timers patch Subject: [lng-odp] [Patch v3 2/2] example: timer: use ability to indicate that event was lost X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ivan.khoronzhuk@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.217.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 In case if for some reason one of the TMOs was lost, the test will be polling forever in order to take it and delete. It can be used to indicate that event was lost. Just abort the test if it cannot receive one of the "last" TMOs for some period. Signed-off-by: Ivan Khoronzhuk --- example/timer/odp_timer_test.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 29d32af..ecfc708 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -21,6 +21,7 @@ #define MAX_WORKERS 32 /**< Max worker threads */ #define NUM_TMOS 10000 /**< Number of timers */ +#define WAIT_NUM 10 /**< Max tries to rx last tmo per worker */ /** Test arguments */ @@ -112,6 +113,7 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls) uint64_t tick; struct test_timer *ttp; odp_timeout_t tmo; + uint32_t num_workers = gbls->num_workers; EXAMPLE_DBG(" [%i] test_timeouts\n", thr); @@ -141,6 +143,7 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls) tick = odp_timer_current_tick(gbls->tp); while (1) { + int wait = 0; odp_event_t ev; odp_timer_set_t rc; @@ -166,6 +169,9 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls) ev = odp_schedule(&queue, sched_tmo); /* Check if odp_schedule() timed out, possibly there * are no remaining timeouts to receive */ + if (++wait > WAIT_NUM && + odp_atomic_load_u32(&gbls->remain) < num_workers) + EXAMPLE_ABORT("At least one TMO was lost\n"); } while (ev == ODP_EVENT_INVALID && (int)odp_atomic_load_u32(&gbls->remain) > 0); @@ -193,7 +199,7 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls) if (!rx_num) EXAMPLE_ABORT("Unexpected timeout received (timer %x, tick %"PRIu64")\n", ttp->tim, tick); - else if (rx_num > gbls->num_workers) + else if (rx_num > num_workers) continue; odp_timeout_free(odp_timeout_from_event(ttp->ev));