Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp2251165ybg; Thu, 30 Jul 2020 14:42:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLMQBdTww7Fjcal7sriRbhMBc9KaelgsPjQEI2qatCaxdNQaplTAq68QBBoQjhX1qNevDq X-Received: by 2002:a50:d784:: with SMTP id w4mr1071337edi.34.1596145372309; Thu, 30 Jul 2020 14:42:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596145372; cv=none; d=google.com; s=arc-20160816; b=SfWa/GTPRJdXsh/kzrvF64xQaE2OFdV4V9+nKZATvY1uthCXNSOWCEqL0k7sYRIPP8 988tbw7j80M4J6rOQo8vvqOItZGfNd/ILdRqZZF1se4MndNIGcLnRpvfjqiyY4i65DtW 5IAD+F8DKqLqWy7kROuESyCLuoNwXae32aRkLe4S3lALoHyDyDADT7pv2mPRhJSksekN QbWLMHkC7+1yRkJNxgXT9sYY/Ou5hVl07cNdx4clv+6RRgXZyLStcoCDvCJfMRPdcSGg F+jCCXaqj+eIHkYiMWtSBTRBMRKofkxf56ZpVkEJ0dX0EWHmPswKs/OIXt/RDf3vh2YA 3zCQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=bwRNPhOezWnjLv6ewHBPuzk+XMgTgDYboaH0PhWuxOY=; b=Y5fsVLPmh/+eaGbJgsuEHXDntsIwy4ItZDPw6TKMbNtpDLVwbUyvahRiGpclXPVaIs MAEFOnNGCBJ8ranLGs6676qcr/2bNXaXlyuRhIJNQNkLwYicGVNSvqy+kQuDU+guVkP8 e1/EwTqIrh8ueEYcUN3PUkpheeWGGczzi7nIOYFC25WoLxPeUH5tsMpONIHmcuUVUo4e 97SqPojdZEyN29AbtRRWraC5n76dncNoM8oaCohdb1kjvc971UO8iZwcSqkdM2hKGUiB kHA9j3dC5k0lJuKx7LE37tn5g5Oq4ACdbFGXDNMXm25Yq2wtUXaIXk+DsSwN12xx4iUg KCww== ARC-Authentication-Results: i=1; mx.google.com; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l16si3978267edw.172.2020.07.30.14.42.30; Thu, 30 Jul 2020 14:42:52 -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; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730750AbgG3Vk7 convert rfc822-to-8bit (ORCPT + 99 others); Thu, 30 Jul 2020 17:40:59 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:37655 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730734AbgG3Vkz (ORCPT ); Thu, 30 Jul 2020 17:40:55 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-118-OOTwgVC_NCy-2dxwqIZQbQ-1; Thu, 30 Jul 2020 17:40:17 -0400 X-MC-Unique: OOTwgVC_NCy-2dxwqIZQbQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0F13C1DFB; Thu, 30 Jul 2020 21:40:16 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.194.223]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F63F87B20; Thu, 30 Jul 2020 21:40:01 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Ian Rogers , Andi Kleen , David Ahern , =?UTF-8?q?Genevi=C3=A8ve=20Bastien?= , Wang Nan , Jeremie Galarneau Subject: [PATCH 1/6] perf tools: Add clockid_name function Date: Thu, 30 Jul 2020 23:39:45 +0200 Message-Id: <20200730213950.1503773-2-jolsa@kernel.org> In-Reply-To: <20200730213950.1503773-1-jolsa@kernel.org> References: <20200730213950.1503773-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jolsa@kernel.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding clockid_name function to get the clock name based on its clockid. It will be used in following changes. Signed-off-by: Jiri Olsa --- tools/perf/builtin-record.c | 11 +++++++++++ tools/perf/util/util.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index b6bdccd875bc..468c669519a6 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -2121,6 +2121,17 @@ static const struct clockid_map clockids[] = { CLOCKID_END, }; +const char *clockid_name(clockid_t clk_id) +{ + const struct clockid_map *cm; + + for (cm = clockids; cm->name; cm++) { + if (cm->clockid == clk_id) + return cm->name; + } + return "(not found)"; +} + static int get_clockid_res(clockid_t clk_id, u64 *res_ns) { struct timespec res; diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index f486fdd3a538..126dad238ee3 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h @@ -62,4 +62,6 @@ char *perf_exe(char *buf, int len); #endif #endif +const char *clockid_name(clockid_t clk_id); + #endif /* GIT_COMPAT_UTIL_H */ -- 2.25.4