From patchwork Tue Aug 11 07:33:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: hongbo.zhang@freescale.com X-Patchwork-Id: 52291 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by patches.linaro.org (Postfix) with ESMTPS id E6C5D22919 for ; Tue, 11 Aug 2015 07:58:41 +0000 (UTC) Received: by labd1 with SMTP id d1sf25526712lab.0 for ; Tue, 11 Aug 2015 00:58:40 -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:mime-version:spamdiagnosticoutput :spamdiagnosticmetadata:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :content-type:content-transfer-encoding:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=9AY89UHwlAKpW8E9Bl/Ra30Lhz2BmdZQEtpnlP2rnw0=; b=dv9Y/LC/jtbVUG6SxlOrE5X41rZXLKFxEmxUz0P02HYutDvgVyjlAZqDgETZFgmZPK cZp20J2BYUfkXZ79lIPW3F0r8MwqcGgyVHg756w/2raxeSt1e05r3XoGaOAWMam7LzHU RVmpCBxtPJ+K4M7TV9mrDSqH6/rbHLyroLgdwzkgv7Mk6xY65by0+Izj3mqSHxuAmROX Tbi44RoXTZjweP4kq+AxaXwu0cBNeMykOVmyLKUeZKUA0RtkstQfe0xM2MBC/Zvso5eA 3bPJ0wvkEYnDOdFTRDw7OTGRsmcOjfeEyGOChov5CMWqf/2vqf7b+BbDmZPBfIkxbDkD 7n/g== X-Gm-Message-State: ALoCoQk8/EKQ+RmfVj/A6XZP8nrgb+TwKMdWZCG/D1V3AVCtb/9B621ttCxj8MVFmaNdCcjs9ujd X-Received: by 10.112.99.37 with SMTP id en5mr7583029lbb.7.1439279920881; Tue, 11 Aug 2015 00:58:40 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.41 with SMTP id u9ls200954laz.58.gmail; Tue, 11 Aug 2015 00:58:40 -0700 (PDT) X-Received: by 10.152.163.35 with SMTP id yf3mr10107088lab.84.1439279920750; Tue, 11 Aug 2015 00:58:40 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id av10si752808lbc.94.2015.08.11.00.58.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Aug 2015 00:58:40 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbbpu9 with SMTP id pu9so81133311lbb.3 for ; Tue, 11 Aug 2015 00:58:40 -0700 (PDT) X-Received: by 10.152.36.102 with SMTP id p6mr24828183laj.19.1439279920604; Tue, 11 Aug 2015 00:58:40 -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 l6csp2355552lba; Tue, 11 Aug 2015 00:58:39 -0700 (PDT) X-Received: by 10.50.129.10 with SMTP id ns10mr16677754igb.90.1439279918760; Tue, 11 Aug 2015 00:58:38 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id sd12si1023312igb.91.2015.08.11.00.58.38; Tue, 11 Aug 2015 00:58:38 -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 CD1E062059; Tue, 11 Aug 2015 07:58:37 +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=-1.9 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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 5A61762077; Tue, 11 Aug 2015 07:53:57 +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 8D8C062038; Tue, 11 Aug 2015 07:53:34 +0000 (UTC) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bbn0103.outbound.protection.outlook.com [157.56.111.103]) by lists.linaro.org (Postfix) with ESMTPS id 9EA3862056 for ; Tue, 11 Aug 2015 07:53:02 +0000 (UTC) Received: from BLUPR03CA002.namprd03.prod.outlook.com (10.255.124.19) by BN3PR0301MB1267.namprd03.prod.outlook.com (10.161.209.147) with Microsoft SMTP Server (TLS) id 15.1.225.19; Tue, 11 Aug 2015 07:53:01 +0000 Received: from BY2FFO11FD030.protection.gbl (10.255.124.4) by BLUPR03CA002.outlook.office365.com (10.255.124.19) with Microsoft SMTP Server (TLS) id 15.1.225.19 via Frontend Transport; Tue, 11 Aug 2015 07:53:00 +0000 Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BY2FFO11FD030.mail.protection.outlook.com (10.1.14.211) with Microsoft SMTP Server (TLS) id 15.1.243.9 via Frontend Transport; Tue, 11 Aug 2015 07:53:00 +0000 Received: from hongbo.ap.freescale.net (hongbo.ap.freescale.net [10.193.20.23]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t7B7qjK6024123; Tue, 11 Aug 2015 00:52:58 -0700 From: To: Date: Tue, 11 Aug 2015 15:33:55 +0800 Message-ID: <1439278439-11386-6-git-send-email-hongbo.zhang@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1439278439-11386-1-git-send-email-hongbo.zhang@freescale.com> References: <1439278439-11386-1-git-send-email-hongbo.zhang@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD030; 1:PGJwYRuywqLFdhTuVuEqR/MOHxIg3A9tNQhPFddCq3b69u/eSgIGbHpP56nrg94ka49PrrMQhv4eTKw7u38EtUKYkloi6hCv+Wydbyia/LPJ8bP3NvQRBXuWUNqULneDkPCy1Ti/mcZ9mISidSxmH07TKouTRF0L5L716EjYrzDXewmhFVI0n80QyQL75rJUwItajq+exUHC4U92KxCv4LGGhd/a2hBP8e64f0QwyQqxoKKtH0N0rkB+vRpopS4mqFHMeDt6+5ZoRaa2iSw8i3MqYkmtl0u97fZarPr2AR9HyXDvc6Chf6q457qpO+EfPQBXQEr/SO4iOSdP89CBLKSz/BHbUFsL+GZutbJCsHYZ/5z9g5bGaOXSvy9F28xwBLPh0+1ANmSLyeEQrkp4aQ== X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(3050300001)(339900001)(189002)(199003)(229853001)(86152002)(2351001)(76176999)(86362001)(87936001)(68736005)(2950100001)(5003940100001)(92566002)(575784001)(46102003)(19580395003)(77096005)(47776003)(105606002)(77156002)(6806004)(5001860100001)(97736004)(50226001)(110136002)(19580405001)(69596002)(85426001)(5001960100002)(50986999)(189998001)(4001540100001)(62966003)(81156007)(5001830100001)(33646002)(104016003)(36756003)(106466001)(50466002)(48376002)(64706001)(41533002)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:BN3PR0301MB1267; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diag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yPXxZIqJh96Vc6SoNREpsNT1wsKY69cpP3i4dpqJbo/J7iep9oHecrKYEa7xwOT9dc4cuajMBM/aShNntdoRVVO3/mNkoOPhUfs3nv25DI+Fphvj6Nu6XzRY=; 4:/3noHnNISEB0+zIBOHWOyL6dGFYfiVExAKv+geijW2p1jKG2H1V9xyEomH7Qq4ueY7SEFioVxv6rAW1ah+EXe9zF3cvKxnvq2laKD4cqFGnz/x3Ta/LoX6bU9W/wYRr86Jg0q11xpfJHupkQ74qw0z21f/yvXeB/8/Usc8sYhF4RZ9HSxUWJcIADQR9nn9jFq/RItZGEJoae+2R81y8+TJhXgb+BR4f8Hv0b5M2cnwsOSHEkcnIXmE1fhfOTWMCUPUP+LifWGI3pHx4daNRosW+vX3FhQEtL04+Z5dY6Z08= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:BN3PR0301MB1267; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0301MB1267; X-Forefront-PRVS: 066517B35B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR0301MB1267; 23:q41x4jhlT7FAOWU32c28lMVh9CeSVqr4nJkfZfp?= =?us-ascii?Q?muDuEiT4UfLZnODcwBgL2OILiSYO8otRJsbMKuKELgb2Zycxi6RhDb90Lk0o?= =?us-ascii?Q?J4ptu79Zdf1/v4vZVamUIs3FhCzIEfH211U7+oJxRK3RriUh1LT/6cjHwYOe?= =?us-ascii?Q?aMbazoCcr44s2f4REvs380sNnFIOibYxtMypbTVkphQZquvIB2xXcfhOehOO?= =?us-ascii?Q?DnHNAls/b4QMLU9xYu6A074au0xHf7el8IfHBMbpI6IT+S3UAN7/ybEJKb6d?= =?us-ascii?Q?Pqvspuv/rGWd5Luj3O6F9dvCP5Vmm+2Ue7x2dzPmuW2370TZ1Vvgdhb/pMTP?= =?us-ascii?Q?k3epLnBRACuVMQ7z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Q?=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR0301MB1267; 5:PYS1fx00uLeNqqrJd/5NwcgdxnYWqtr9lGQlpAjXYuLa2RDxzqcyMXz+ecLWR8d0XedqMIE8t2Gwb2XyO3mPKDeEZTOi+nNEj6rq7I9azmaqPeJ4ykopgrKCELIrER+Aq9lpsrjoZonSTqTOL9ExqQ==; 24:MsaDWQFGunZhf1Nn28LHk7dFmskOtbiNvdRYIa1r8/wRxdrMqmanfPLlzf94PoVnE4Ilhh0XkDKgeYzncw/ql/McWQFT3mYj5xEtqiy1+hw=; 20:b0FD6EjJEFTpPgDNikUXlmkhQ11myIY9Jz8AQf0/UmIHFGgbAXCSnlrABmtfpURLdXRJx6sOlnYA6v5kZWW6ow== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Aug 2015 07:53:00.5493 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0301MB1267 X-Topics: patch Cc: stuart.haslam@arm.com, petri.savolainen@nokia.com Subject: [lng-odp] [API-NEXT PATCH v4 05/10] linux-generic: sysinfo: clarify the API for max CPU frequency 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: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@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.179 as permitted sender) smtp.mailfrom=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 From: Hongbo Zhang Currently the API to get CPU frequency is vague, it needs to be clarified whether max or current frequency is returned, and now most use cases want to get max capacity of CPU in fact, so this patch makes it clear that the cpu_hz stand for max CPU frequency. (there is no need to store current instant frequency) Accordingly the API odp_cpu_hz() is renamed to odp_cpu_hz_max(). While there may still be some use case of acquiring the current CPU frequency, so the previous odp_cpu_hz() will be re-implemented for this purpose in the next patch. As to platforms other than x86, if their cpu_hz's don't stand for max CPU frequency, they should be changed following up this patch, and then max or current frequency of CPU should be clear. Signed-off-by: Hongbo Zhang --- example/classifier/odp_classifier.c | 2 +- example/generator/odp_generator.c | 2 +- example/ipsec/odp_ipsec.c | 2 +- example/packet/odp_pktio.c | 2 +- example/timer/odp_timer_test.c | 4 ++-- include/odp/api/cpu.h | 2 +- platform/linux-generic/arch/linux/odp_time.c | 2 +- platform/linux-generic/odp_system_info.c | 22 +++++++--------------- platform/linux-generic/odp_time.c | 4 ++-- test/api_test/odp_common.c | 2 +- test/performance/odp_atomic.c | 2 +- test/performance/odp_l2fwd.c | 2 +- test/performance/odp_scheduling.c | 2 +- test/validation/system/system.c | 6 +++--- test/validation/system/system.h | 2 +- 15 files changed, 25 insertions(+), 33 deletions(-) diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 8b68ce0..16e567d 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -733,7 +733,7 @@ static void print_info(char *progname, appl_args_t *appl_args) "CPU count: %i\n" "\n", odp_version_api_str(), odp_cpu_model_str(), - odp_cpu_hz(), odp_sys_cache_line_size(), + odp_cpu_hz_max(), odp_sys_cache_line_size(), odp_cpu_count()); printf("Running ODP appl: \"%s\"\n" diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 2ed4ea2..7982801 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -988,7 +988,7 @@ static void print_info(char *progname, appl_args_t *appl_args) "Cache line size: %i\n" "CPU count: %i\n" "\n", - odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(), + odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz_max(), odp_sys_cache_line_size(), odp_cpu_count()); printf("Running ODP appl: \"%s\"\n" diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 32a91e4..b2bc501 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -1516,7 +1516,7 @@ static void print_info(char *progname, appl_args_t *appl_args) "Cache line size: %i\n" "CPU count: %i\n" "\n", - odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(), + odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz_max(), odp_sys_cache_line_size(), odp_cpu_count()); printf("Running ODP appl: \"%s\"\n" diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index 75de6b8..f0bc528 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -628,7 +628,7 @@ static void print_info(char *progname, appl_args_t *appl_args) "Cache line size: %i\n" "CPU count: %i\n" "\n", - odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(), + odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz_max(), odp_sys_cache_line_size(), odp_cpu_count()); printf("Running ODP appl: \"%s\"\n" diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index b7d3dcd..68345b7 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -350,7 +350,7 @@ int main(int argc, char *argv[]) printf("---------------\n"); printf("ODP API version: %s\n", odp_version_api_str()); printf("CPU model: %s\n", odp_cpu_model_str()); - printf("CPU freq (hz): %"PRIu64"\n", odp_cpu_hz()); + printf("CPU freq (hz): %"PRIu64"\n", odp_cpu_hz_max()); printf("Cache line size: %i\n", odp_sys_cache_line_size()); printf("Max CPU count: %i\n", odp_cpu_count()); @@ -445,7 +445,7 @@ int main(int argc, char *argv[]) return -1; } - printf("CPU freq %"PRIu64" Hz\n", odp_cpu_hz()); + printf("CPU freq %"PRIu64" Hz\n", odp_cpu_hz_max()); printf("Cycles vs nanoseconds:\n"); ns = 0; cycles = odp_time_ns_to_cycles(ns); diff --git a/include/odp/api/cpu.h b/include/odp/api/cpu.h index 7b548ce..9d0aaf5 100644 --- a/include/odp/api/cpu.h +++ b/include/odp/api/cpu.h @@ -48,7 +48,7 @@ int odp_cpu_count(void); * * @return CPU frequency in Hz */ -uint64_t odp_cpu_hz(void); +uint64_t odp_cpu_hz_max(void); /** * CPU model name diff --git a/platform/linux-generic/arch/linux/odp_time.c b/platform/linux-generic/arch/linux/odp_time.c index 3309da0..ed6e560 100644 --- a/platform/linux-generic/arch/linux/odp_time.c +++ b/platform/linux-generic/arch/linux/odp_time.c @@ -28,7 +28,7 @@ uint64_t odp_time_cycles(void) if (ret != 0) ODP_ABORT("clock_gettime failed\n"); - hz = odp_cpu_hz(); + hz = odp_cpu_hz_max(); sec = (uint64_t) time.tv_sec; ns = (uint64_t) time.tv_nsec; diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index 8e903b0..d78fd3e 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -121,35 +121,27 @@ static int cpuinfo_x86(FILE *file, odp_system_info_t *sysinfo) { char str[1024]; char *pos; - double mhz = 0.0; + double ghz = 0.0; int model = 0; - int count = 2; + int count = 1; while (fgets(str, sizeof(str), file) != NULL && count > 0) { - if (!mhz) { - pos = strstr(str, "cpu MHz"); - if (pos) { - sscanf(pos, "cpu MHz : %lf", &mhz); - count--; - } - } - if (!model) { pos = strstr(str, "model name"); if (pos) { - int len; pos = strchr(str, ':'); strncpy(sysinfo->model_str[0], pos + 2, sizeof(sysinfo->model_str[0])); - len = strlen(sysinfo->model_str[0]); - sysinfo->model_str[0][len - 1] = 0; + pos = strchr(sysinfo->model_str[0], '@'); + *(pos - 1) = '\0'; + sscanf(pos, "@ %lfGHz", &ghz); model = 1; count--; } } } - sysinfo->cpu_hz[0] = (uint64_t)(mhz * 1000000.0); + sysinfo->cpu_hz[0] = (uint64_t)(ghz * 1000000000.0); return 0; } @@ -374,7 +366,7 @@ int odp_system_info_init(void) * Public access functions ************************* */ -uint64_t odp_cpu_hz(void) +uint64_t odp_cpu_hz_max(void) { return odp_global_data.system_info.cpu_hz[0]; } diff --git a/platform/linux-generic/odp_time.c b/platform/linux-generic/odp_time.c index a137a36..f864ade 100644 --- a/platform/linux-generic/odp_time.c +++ b/platform/linux-generic/odp_time.c @@ -23,7 +23,7 @@ uint64_t odp_time_diff_cycles(uint64_t t1, uint64_t t2) uint64_t odp_time_cycles_to_ns(uint64_t cycles) { - uint64_t hz = odp_cpu_hz(); + uint64_t hz = odp_cpu_hz_max(); if (cycles > (UINT64_MAX / GIGA)) return (cycles/hz)*GIGA; @@ -34,7 +34,7 @@ uint64_t odp_time_cycles_to_ns(uint64_t cycles) uint64_t odp_time_ns_to_cycles(uint64_t ns) { - uint64_t hz = odp_cpu_hz(); + uint64_t hz = odp_cpu_hz_max(); if (ns > (UINT64_MAX / hz)) return (ns/GIGA)*hz; diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c index 8d05efe..bb89f63 100644 --- a/test/api_test/odp_common.c +++ b/test/api_test/odp_common.c @@ -42,7 +42,7 @@ void odp_print_system_info(void) printf("---------------\n"); printf("ODP API version: %s\n", odp_version_api_str()); printf("CPU model: %s\n", odp_cpu_model_str()); - printf("CPU freq (hz): %"PRIu64"\n", odp_cpu_hz()); + printf("CPU freq (hz): %"PRIu64"\n", odp_cpu_hz_max()); printf("Cache line size: %i\n", odp_sys_cache_line_size()); printf("CPU count: %i\n", odp_cpu_count()); printf("CPU mask: %s\n", str); diff --git a/test/performance/odp_atomic.c b/test/performance/odp_atomic.c index 74d4f3a..dea6210 100644 --- a/test/performance/odp_atomic.c +++ b/test/performance/odp_atomic.c @@ -338,7 +338,7 @@ void odp_print_system_info(void) printf("---------------\n"); printf("ODP API version: %s\n", odp_version_api_str()); printf("CPU model: %s\n", odp_cpu_model_str()); - printf("CPU freq (hz): %"PRIu64"\n", odp_cpu_hz()); + printf("CPU freq (hz): %"PRIu64"\n", odp_cpu_hz_max()); printf("Cache line size: %i\n", odp_sys_cache_line_size()); printf("CPU count: %i\n", odp_cpu_count()); printf("CPU mask: %s\n", str); diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index 6951837..37c62ca 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -641,7 +641,7 @@ static void print_info(char *progname, appl_args_t *appl_args) "Cache line size: %i\n" "CPU count: %i\n" "\n", - odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz(), + odp_version_api_str(), odp_cpu_model_str(), odp_cpu_hz_max(), odp_sys_cache_line_size(), odp_cpu_count()); printf("Running ODP appl: \"%s\"\n" diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index a73f013..53f84a7 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -881,7 +881,7 @@ int main(int argc, char *argv[]) printf("---------------\n"); printf("ODP API version: %s\n", odp_version_api_str()); printf("CPU model: %s\n", odp_cpu_model_str()); - printf("CPU freq (hz): %"PRIu64"\n", odp_cpu_hz()); + printf("CPU freq (hz): %"PRIu64"\n", odp_cpu_hz_max()); printf("Cache line size: %i\n", odp_sys_cache_line_size()); printf("Max CPU count: %i\n", odp_cpu_count()); diff --git a/test/validation/system/system.c b/test/validation/system/system.c index 54cb7c5..9134161 100644 --- a/test/validation/system/system.c +++ b/test/validation/system/system.c @@ -75,11 +75,11 @@ void system_test_odp_sys_huge_page_size(void) CU_ASSERT(0 < page); } -void system_test_odp_cpu_hz(void) +void system_test_odp_cpu_hz_max(void) { uint64_t hz; - hz = odp_cpu_hz(); + hz = odp_cpu_hz_max(); CU_ASSERT(0 < hz); } @@ -90,7 +90,7 @@ CU_TestInfo system_suite[] = { {"odp_cpu_model_str", system_test_odp_cpu_model_str}, {"odp_sys_page_size", system_test_odp_sys_page_size}, {"odp_sys_huge_page_size", system_test_odp_sys_huge_page_size}, - {"odp_cpu_hz", system_test_odp_cpu_hz}, + {"odp_cpu_hz_max", system_test_odp_cpu_hz_max}, CU_TEST_INFO_NULL, }; diff --git a/test/validation/system/system.h b/test/validation/system/system.h index d05f104..67ddb7a 100644 --- a/test/validation/system/system.h +++ b/test/validation/system/system.h @@ -16,7 +16,7 @@ void system_test_odp_sys_cache_line_size(void); void system_test_odp_cpu_model_str(void); void system_test_odp_sys_page_size(void); void system_test_odp_sys_huge_page_size(void); -void system_test_odp_cpu_hz(void); +void system_test_odp_cpu_hz_max(void); /* test arrays: */ extern CU_TestInfo system_suite[];