Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1271434ybl; Fri, 23 Aug 2019 16:38:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqydv0n2LLWWmU7zEwJlQgxci5wR2A4YPI590dNSXg6Jxyuh0rkG+EHMuFO4uzrEEIriUmB7 X-Received: by 2002:a62:7790:: with SMTP id s138mr7745394pfc.243.1566603510967; Fri, 23 Aug 2019 16:38:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566603510; cv=none; d=google.com; s=arc-20160816; b=hs1SmzyHpY86v1DTrd9PgjLaWrh376BuGT35P3JE4xPGsigkxPlmzh+UWlpMA87ogI YTwcqt4U/uRODrgh3JCjFcALnSo2d5+UKLwXWP5EokuytOfMp7njw/LcuZzyh9IXyDmn Zm/1dl1T3w3X69jVOanhmu1aOnuJO6W7wDL8NmK/SsbHcIRVr9mKBT6nXgbyKSaRfjF9 Gjyzv4tFf0i1k6hhr9znZM3nV8B2q5wt5W3kNa6gSApc6ClaMhI6xbZXjVFh4gW2wEso FA9enmvJxypBDkkJrthCGtkGsCfHCFLzp6TA4Q4j2xAsyW44aux8ZcRMNgOGAM6YBSfw YNKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=K0qck3v93VATnE20OYyFnbl5n/acrQKKYJnWD521bbo=; b=obCqMzCsobOp0YbLY+0gledYf0GZrENaM2nK9n20OBKqOmqPflWPKpRNfDxrsJJHpU iENbUbSBTUTInZPvm4sN/9WZo/76vpPHso7aW0NP+np88GawGcHkcGQyxSuhR6XWuxzs cc9VjMJRSx2tDZ+cP5JLd1nWGi2calkGMxI+slpMbEP2Cx28FA994lyOarIENfb8TP3k /4GRnZcyYL8Nf1Y3nUY88xXEKgDh38K4lj+SRkWchk1sRAwXMXFXmNndJLcymbF+HWS3 19neZVGwod/gfMgXAtYRcguSmqU827JJGpxBclwI5T2ZYgk7mX+Z3bdWlCeOzSc+jeqI RXJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b14si2993549pgi.587.2019.08.23.16.38.16; Fri, 23 Aug 2019 16:38:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390187AbfHWVDo (ORCPT + 99 others); Fri, 23 Aug 2019 17:03:44 -0400 Received: from mga07.intel.com ([134.134.136.100]:36059 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729922AbfHWVDo (ORCPT ); Fri, 23 Aug 2019 17:03:44 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Aug 2019 14:03:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,422,1559545200"; d="scan'208";a="191058781" Received: from tassilo.jf.intel.com (HELO tassilo.localdomain) ([10.7.201.137]) by orsmga002.jf.intel.com with ESMTP; 23 Aug 2019 14:03:43 -0700 Received: by tassilo.localdomain (Postfix, from userid 1000) id 73E23301C0B; Fri, 23 Aug 2019 14:03:43 -0700 (PDT) From: Andi Kleen To: acme@kernel.org Cc: jolsa@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen Subject: [PATCH 1/2] perf report: Use timestamp__scnprintf_nsec for time sort key Date: Fri, 23 Aug 2019 14:03:37 -0700 Message-Id: <20190823210338.12360-1-andi@firstfloor.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andi Kleen Use timestamp__scnprintf_nsec to print nanoseconds for the time sort key, instead of open coding. Signed-off-by: Andi Kleen --- tools/perf/util/sort.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index f9a38a1dd4d1..0985e9072db0 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c @@ -668,17 +668,11 @@ sort__time_cmp(struct hist_entry *left, struct hist_entry *right) static int hist_entry__time_snprintf(struct hist_entry *he, char *bf, size_t size, unsigned int width) { - unsigned long secs; - unsigned long long nsecs; char he_time[32]; - nsecs = he->time; - secs = nsecs / NSEC_PER_SEC; - nsecs -= secs * NSEC_PER_SEC; - if (symbol_conf.nanosecs) - snprintf(he_time, sizeof he_time, "%5lu.%09llu: ", - secs, nsecs); + timestamp__scnprintf_nsec(he->time, he_time, + sizeof(he_time)); else timestamp__scnprintf_usec(he->time, he_time, sizeof(he_time)); -- 2.20.1