Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp280395pxb; Sat, 21 Aug 2021 02:25:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwzUSGNBNhFIt9E720FBZ/d12gB90M+yP2rcH5C/yvmqtad8mlyGHudGkgcokvfowzvixMC X-Received: by 2002:a17:906:7716:: with SMTP id q22mr26460055ejm.457.1629537937193; Sat, 21 Aug 2021 02:25:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629537937; cv=none; d=google.com; s=arc-20160816; b=EqjQ81+Vy9QWub4XLCnlctMsCcllCGDlrCF2sJebrVhi8pZWU5jHZwTQ1+M8Zupw/4 +IKRPq2uifUM0IO+GdtjfcF030LThcfg7vhVCzxHg9wj4GtZBOvp9404eRbGNPU/dZbx PnsfPxSOkAn+Qegt6IIudOjEyAZoVYyo4W7AcNcGHDWcMVdV4Q1l95YZXxCokBhSbqe2 PnvuBMSWIbZVoRyBHfSYVeXJsAv9KV8hYzHosBDkC0iJ3f2f8CCTxsO+5ll4c1Vhp4+a 2UBeLwSwiyFu7/nUzr38Jy6wf4JkULWnj/m/Y1Cqce89FS0FqVdGfRHpJjLl0OSrGXuJ 5MZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=luODGGdTKMSVHQNhZwY0q6ykClJFkZ30Qtks/1RszYE=; b=BSCEEoiUYMMPOQ6HWP4LUFbpmOc1N3d+wZn2JjaeH2kA+F6GMgqLPlyPFRNuRynQM7 pLqQWyge/CIljM8kjCsHpnm7YmE38LYk9LiMu3sDAGdbAoHnjAhYcvS3qIHVZOlyrSbR 0E1QJFQxG2bMXvqzZ0tcjLDHUW1Ri4CY63gi+upEGSPW7T3wjT58NaVExMrzx/NXQcxh q1kfSKMS9ICYzXaHbFmH0zfglWmz2kg1QAuzMj7y0+E/lvXUSunU2viT8lFiG2U6Bzm+ zZzF6J5K7ZtHFo6OfUWSufKBWX7DunNWaZxq6ASakqdvALPePa/alaZQ5sLEoZZtOz1E LcaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rxguwcdI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v4si10668428edj.103.2021.08.21.02.25.13; Sat, 21 Aug 2021 02:25:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rxguwcdI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233445AbhHUJXZ (ORCPT + 99 others); Sat, 21 Aug 2021 05:23:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234680AbhHUJWd (ORCPT ); Sat, 21 Aug 2021 05:22:33 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DAC5C061156; Sat, 21 Aug 2021 02:20:35 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id e21so9301183ejz.12; Sat, 21 Aug 2021 02:20:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=luODGGdTKMSVHQNhZwY0q6ykClJFkZ30Qtks/1RszYE=; b=rxguwcdIVN6PUc+2PVw9G6OIRfOCWxNfYnKXtvbbMX/eeIbd4pTQ4qofcRbBIv5DHY OYfZS9M0/CWVffCZoTtl0C3jwDS2QI43pmIEUTiD4Einub29D4MdUCGue8YE5NGUl5Gs 6YMi5FqQhc4b8ZjpVBDrqTr0BtdTNZJ30WqotQcdgEV/xtRRDDhe/+ZVpUiJp2QpV2lz /dBjYvypxxQ8ECFJbBTNc7eNI9+60UzGkIVKZCGQClZRnetCgT6LEocF4BtLS9KeNYyv grsZksuoN2FRtK9HuAdfImNqFh78OeF3r3PAqBlAC3avq68QTabHhe+gTC7HT3mXFZgM pIfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=luODGGdTKMSVHQNhZwY0q6ykClJFkZ30Qtks/1RszYE=; b=LPoNe4RZDvnnryRVy4CUGnMJo5wbmvxHwD9xIVc9GYgv7gRLAvvLfktptCX4eeGNdM UQaYffsmQFbHnLNfif2mjL4DDWsiyec8OcC0N7lqq83qaGHWyq+BB0eTMin4AnJYpTOe /snyi2cEPFcQHR6kNyu2yq3rT8H7np7sIT+ZtRDNjDE2fZr4DShasowW6/6Vr1RmTPNI oKne4Euupw09jg9e3O5cHzxRsql7o0rPl1p8gAdj0rK0PuTEhtCAfQIMDcoXehkOE2b9 i1oz3qoCzJlmTIUVLZX6GiqzwqHAs+iaY6ZfKmD3Wd/qy1iaR8f6bRHMDK1MWjWbTr/u LPJA== X-Gm-Message-State: AOAM5320rVgYPrcAtcgYf2qt6wiPsYm5ipPd0WnJ372YM1dm5XxFOt3i MGND+GmZMP4JjlcQ1nrtKKQ= X-Received: by 2002:a17:906:fb91:: with SMTP id lr17mr25878506ejb.110.1629537633955; Sat, 21 Aug 2021 02:20:33 -0700 (PDT) Received: from honeypot.. (mob-176-243-254-204.net.vodafone.it. [176.243.254.204]) by smtp.googlemail.com with ESMTPSA id a25sm4003878ejv.91.2021.08.21.02.20.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Aug 2021 02:20:33 -0700 (PDT) From: Riccardo Mancini To: Arnaldo Carvalho de Melo Cc: Ian Rogers , Namhyung Kim , Peter Zijlstra , Ingo Molnar , Mark Rutland , Jiri Olsa , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Riccardo Mancini Subject: [RFC PATCH v1 36/37] perf test/evlist-open-close: use inline func to convert timeval to usec Date: Sat, 21 Aug 2021 11:19:42 +0200 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch introduces a new inline function to convert a timeval to usec. This function will be used also in the next patch. Signed-off-by: Riccardo Mancini --- tools/perf/bench/evlist-open-close.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/perf/bench/evlist-open-close.c b/tools/perf/bench/evlist-open-close.c index c18aa85725281795..00d0aef564f80d44 100644 --- a/tools/perf/bench/evlist-open-close.c +++ b/tools/perf/bench/evlist-open-close.c @@ -26,6 +26,11 @@ static int iterations = 100; static int nr_events = 1; static const char *event_string = "dummy"; +static inline u64 timeval2usec(struct timeval *tv) +{ + return tv->tv_sec * USEC_PER_SEC + tv->tv_usec; +} + static struct record_opts opts = { .sample_time = true, .mmap_pages = UINT_MAX, @@ -197,7 +202,7 @@ static int bench_evlist_open_close__run(char *evstr) gettimeofday(&end, NULL); timersub(&end, &start, &diff); - runtime_us = diff.tv_sec * USEC_PER_SEC + diff.tv_usec; + runtime_us = timeval2usec(&diff); update_stats(&time_stats, runtime_us); evlist__delete(evlist); -- 2.31.1