From patchwork Thu Sep 17 13:10:05 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: 53806 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 B60D422E57 for ; Thu, 17 Sep 2015 13:31:37 +0000 (UTC) Received: by lanb10 with SMTP id b10sf6969727lan.3 for ; Thu, 17 Sep 2015 06:31:36 -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=ywvX+v316A2WJaa9zHTijUmL8o7xLFhapwuvhlqiUms=; b=M2SvSgkyr5Sr8h8HaTdfxQLmmIohXZ0md7T3nFoINe1wWAwQogVS4aNG6xQrSYK21W fMbjjGLUpitMMBANR28WdMzfL6KyKrP0/OXTALTsK2ZOwtAj5YzS6MwnneO00NYdoHBF hh4wv1NgQaJcodCYyfry4wv1IdqVeOBWjXRy39WFqz6ewHL6MGk154XaC/Aji9URZlEM N/DSisoPX1qUwp7Jty5+P3zIvo2CXMDPyPfEuK7Ouj8evRbt/VueXewnqKKAkT9fhyeQ v6rCOzHs+YLkyevz6MGlrGn/2WFUfscFRzbw8Fan2zG2vwCtcJvcGQdJiOmetpszpbKB 3How== X-Gm-Message-State: ALoCoQn+8QI/LJVPv+Xhm4JgCBz9aJZEJ7ufxJjC39o7iDV1+QX1l30K+sUqni8TP2AKe4/YjZ4w X-Received: by 10.180.8.135 with SMTP id r7mr787395wia.0.1442496696644; Thu, 17 Sep 2015 06:31:36 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.161.234 with SMTP id xv10ls85951lab.51.gmail; Thu, 17 Sep 2015 06:31:36 -0700 (PDT) X-Received: by 10.153.7.138 with SMTP id dc10mr31887909lad.23.1442496696500; Thu, 17 Sep 2015 06:31:36 -0700 (PDT) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id un4si2147694lbb.142.2015.09.17.06.31.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 17 Sep 2015 06:31:36 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by lbbmp1 with SMTP id mp1so9296121lbb.1 for ; Thu, 17 Sep 2015 06:31:36 -0700 (PDT) X-Received: by 10.152.43.137 with SMTP id w9mr37177572lal.56.1442496696389; Thu, 17 Sep 2015 06:31:36 -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.59.35 with SMTP id w3csp3073640lbq; Thu, 17 Sep 2015 06:31:35 -0700 (PDT) X-Received: by 10.107.46.101 with SMTP id i98mr6302753ioo.17.1442496695220; Thu, 17 Sep 2015 06:31:35 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 67si2477980ioe.85.2015.09.17.06.31.34; Thu, 17 Sep 2015 06:31:35 -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 91C1262D63; Thu, 17 Sep 2015 13:31:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 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 [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id F1E8162D5D; Thu, 17 Sep 2015 13:26:05 +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 E026962D6C; Thu, 17 Sep 2015 13:25:59 +0000 (UTC) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1bbn0101.outbound.protection.outlook.com [157.56.111.101]) by lists.linaro.org (Postfix) with ESMTPS id 2875D62D5B for ; Thu, 17 Sep 2015 13:24:44 +0000 (UTC) Received: from BL2PR03MB481.namprd03.prod.outlook.com (10.141.92.140) by BL2PR03MB116.namprd03.prod.outlook.com (10.255.230.28) with Microsoft SMTP Server (TLS) id 15.1.256.15; Thu, 17 Sep 2015 13:24:43 +0000 Received: from BN3PR0301CA0030.namprd03.prod.outlook.com (10.160.180.168) by BL2PR03MB481.namprd03.prod.outlook.com (10.141.92.140) with Microsoft SMTP Server (TLS) id 15.1.274.16; Thu, 17 Sep 2015 13:24:42 +0000 Received: from BL2FFO11FD049.protection.gbl (2a01:111:f400:7c09::164) by BN3PR0301CA0030.outlook.office365.com (2a01:111:e400:4000::40) with Microsoft SMTP Server (TLS) id 15.1.274.16 via Frontend Transport; Thu, 17 Sep 2015 13:24:41 +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 BL2FFO11FD049.mail.protection.outlook.com (10.173.161.211) with Microsoft SMTP Server (TLS) id 15.1.262.18 via Frontend Transport; Thu, 17 Sep 2015 13:24:41 +0000 Received: from hongbo.ap.freescale.net (hongbo.ap.freescale.net [10.193.20.3]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id t8HDOGbl005200; Thu, 17 Sep 2015 06:24:38 -0700 From: To: Date: Thu, 17 Sep 2015 21:10:05 +0800 Message-ID: <1442495411-12362-9-git-send-email-hongbo.zhang@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1442495411-12362-1-git-send-email-hongbo.zhang@freescale.com> References: <1442495411-12362-1-git-send-email-hongbo.zhang@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD049; 1:/IZPxY0a6/HHEXiuOyd0iojFuen3Ywkjr/inid69po9uPds1u+hvW5FIUOCkYgz4s+jbMP8KjQK82DXWm9XxZJaiN9qvCtyJqDvt2usC2brihOjvjt25MaBLAbyGGXZ4DEs24J0Ubs82dXxcaK4D6KJcgZGzWhteVmVgavk9UpnEkOmxLpx0mQMEZLrFoUyL18+bPmdnk63YehL18D/q2XM8/hdOSqU2cHoqSqJkR2QD4axI0F9DS9D2w/l7lNu5sSqCZuv6FKTEkbxL2U+rqzHIjKEP9ucJmLydRgMJE4CV3t7iTizK77aTtqdmWrB4U5Vv349oF6Y+voNDwoax2sdvX7EKL40pNRvW3ymQgwp2xmvDL8IC4pYN6YbEWyueRgSO4ujNajBl3s2i5hHcEA== X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(86362001)(5007970100001)(46102003)(19580395003)(62966003)(19580405001)(92566002)(68736005)(77096005)(69596002)(77156002)(6806004)(86152002)(50226001)(2950100001)(5001960100002)(33646002)(50466002)(110136002)(105606002)(5003940100001)(36756003)(104016003)(11100500001)(97736004)(2351001)(50986999)(5001830100001)(5001860100001)(76176999)(4001540100001)(64706001)(106466001)(47776003)(81156007)(189998001)(229853001)(85426001)(87936001)(48376002)(41533002)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:BL2PR03MB481; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB481; 2:Q80Lcu3dqp5uGErtiuYwwOkYbmRpgTS4cjedOEmzDVzW48WtYBriuDyb4jQRWAZ+tSJhRYdmmXunN9UVvTdcb0Y8cVQwQPeDIWlfVTsAXBlOdbRYcfcn5+r83ynLxmu27oh6KxAZQ0/zdmrBBnXcJw3onfNf8kNuDxGpnOihHSE=; 3:kHuzlUrYEKcCE5qVxlYs9ncBOMUBeA2WgUvSVwz4LtCo+jAwyKOCSgl5T3tZ1oWIUUN/EJhLE3VRnmmYgiu1CvOjBSzv67NV/MywTp3pf1Y5qeVrX3DPFStuyVLpQG5gCS84UistqJGdHMve/tW1F1hvpCroXI86Q6wT1hZPlYFzXFnpoKeKbA+xpJLuSxtPE5TIzHHdd6FABYmY0nEDfLzXykUbDi+Rt7BWzAG0v+w=; 25:2P2Dv/djbtGh+BGqIv1ki8VXD9mw2oW0Oiz/7nPacwsLQBaRtrewE83FgTBE6cScYUAFLk4SjwhOM2XI4kG4wgCL7zOadz8csXtmPUSgqNpY/rGl0hBsv7NnXCQlMB1o5sBtEm+KBmPfQIbw0PRAp322Nrl6nU5gg0Ulp5JjdPaSYglZ62DzmXQsKwz2UHhetpYKDuBAc9lqh03HM8NcNrsRF5tBowdZ3I43Ae+e3TiR7TEy+kQji47lzEdeWNSxmSCZqlSp5pKjFZF1qVqY0g== X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:; SRVR:BL2PR03MB481; UriScan:; BCL:0; PCL:0; RULEID:; SRVR:BL2PR03MB116; X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB481; 20:3Fb2BNGJeUjVw8DVDMeXV/0lgaQtn9OSZwxY9tgr9bZ0135VIZ6ZvNDXfdyHi2sF25ZswsKPsFweyIqVJ9LnQACh8iOuEu0rXMC2iFiZvKNA33vz8vdlciySi5QOsR9So8FjY1x1lWiq/7fLZJPkTy8v09ppxn1COQPC67UmL9hYmOKAxPwfRXeQhOgpSWW/GAExPKce39r8GXLhGNobXzsrqNTX9qu0Yo7eIs/kJqd5II5Frm8vkq999y6NbnaRZmHh1sDNSnls7gYpKCgTeikhydRFytT8OUJvUl/CNzQKs+EgakevYUqv6nYal2b+eQPfuR3RWhLG5x88RZN8BznH0Vx+vWPIdG/mHyywo5w=; 4:+g89RlX9e09eoL8JIucNDaAZ0YBjQkByU3CtbcxE4k141pyRDhShuXkGThtic46r8z9BZekePD0BhifxeAi450tT+lFKKCJybVUHSJmgOpkYfrgJii3Bp72up4xjt5b+J5O7oeAud2tUXIi8vxuLIQ4YY4XHhld0g0FX7HOAPdYQlClA8KnVQn1ohOgzHTSwNl5XJQuLzFruukPFvC1e+kIErtF+vbfWsxX8YonKouwps+1Tp5JZgnMPaHXozQlmZTZ616WTg5wH3OT5FVjsGxI3M5Af5XVnifOkLoSeviXunnoQcO6IP5QTxYvzq6X99MuUk9+5PhyDDSrksFnMkw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(520078)(8121501046)(5005006)(3002001); SRVR:BL2PR03MB481; BCL:0; PCL:0; RULEID:; SRVR:BL2PR03MB481; X-Forefront-PRVS: 07025866F6 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BL2PR03MB481; 23:lyJ/2xgsCXBYpflEy7bEQqBrDFrl8eNP/Bbpfah0PT?= =?us-ascii?Q?pvG/dkcwjXEtyTJr0eJw1Yb27ZR0OxMM0OtFXVZ7JTf9Ez4jR4rsMajw0k66?= =?us-ascii?Q?I5BYWSJoKb1CRhfyF8xnBssfs4JlluM4zvLN1g7KieA3HLpI5hPpv9s1BtMk?= =?us-ascii?Q?imSiumic9gDr3WwNHikzm+sS4A18ajpwH3bSZ64FSVKak+5xUeZ48GtBHzaL?= =?us-ascii?Q?r91ygE9kvGJPA4+CYPVTf3IovVKG0SstvKRf2UFeeYxFa1Bf2XOKmHHNZvBw?= =?us-ascii?Q?9tfarHTFRhUYBc+PsXnnusIKPM1hZn5bLuA3665SLqOKlJK4hnSanUedXynj?= =?us-ascii?Q?E30TX2Z2b6Wz4gbWKiH6D3QWjNiNIgNx36iDy4GhicWW1k/ffZ5wKGrzd53l?= =?us-ascii?Q?zk/uvJyuOp4453jBQcQ7Z1VmazU+GlKQ00LbIFCIp9QlsfvcPsOi4Ew/dV4T?= =?us-ascii?Q?b0+P3fJSxFigwOjFvRkmqbonNPmEQLbtBMg4d+exNM4ZQAafi1jqlNJ6wTfu?= =?us-ascii?Q?I7vj0YmTBMjIp49HxqSpFCbwy5UTndWGoMW7vR8fHZMzdTkJSxuWMeFTJFP8?= =?us-ascii?Q?k4onojZ7qy6GrBArNVPckNqz7BLe5gZdBwBfBBYECmoZdHE42jvJ/FcFx6Wc?= =?us-ascii?Q?STRVsnbnSJF/79suHg0uShyw3ZXS6EK1V3GKo7tzqf+USC2/bqHbYWLYizCd?= =?us-ascii?Q?du8FIR6omi1RpMT+DA4BnYE4/SWpYyrBsXJhnUZOrFTslBIizF81d1uhG8yA?= =?us-ascii?Q?aN3bRvLre7M6pr2OPBhWVcJSkzgp+deM8gwIOkpCFIFHhUuz3HxG+u2JcMJR?= =?us-ascii?Q?0IOSp0MM+w66hxXNPnHyJK4jE2DLbMb2N1ifBPUoDjeh9Cl52O4we3OVBQ6J?= =?us-ascii?Q?PwG75/PMYG7ITxwePlucm2xDB6tkQmLob53pjeAOldjISMmworcVkLyAdQBC?= =?us-ascii?Q?nTzsGVKyjoYwnfPMdIMjAtZ0ty8MxuL0t/XlGxpZCUE4KF0xt3ity8cNhwMl?= =?us-ascii?Q?xrRjZrX9MMYAoRW8JyXY7e/L0iFIplvYIyszO8E2eDNFQZ3NFdaLuawN+bgO?= =?us-ascii?Q?VnM0sGFl5g95pF+xOSH+wFp2gKJE/4ABc8ppuvu2U+BGCD895nCPgfnazWm/?= =?us-ascii?Q?HvEvjThZ0jAWNBFeCyYHSLxoThgo8MnnSMQK3wicYRrOLMk9k4pVm2/sAfQG?= =?us-ascii?Q?3x4PMji3j06KIgHqYNcPKKf+X5WbR01JhYhkrqvqeDYxmBHpYzORXSasRSdL?= =?us-ascii?Q?CFl0CxilVE8naWE2bO32GDKWPOb25iZOSZCYbsVPqF8Jqipm/HOmL+DXGkzQ?= =?us-ascii?Q?=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB481; 5:1WzX8mfYjDwyqRgiBAdr5Jh/KTvEoWRee74duumUYGbIVYNfXl/CQBC80l8tuvD3AcyGbwhHru1FIJZqyrgOf7D1Q58oS6V/NW98BsAn9d+bRMes1VAWOI5+zhtae8GIxA+WZ8bxO3YybdLxdHdKLg==; 24:WYhmu59vgfD6ymi9+JGK90D7HRZjGcuWJUy+3k2Mf/AmCZwb2fSr3K2fD0i+zR0eHdWjzl8rRYbUu/RoyfzOLOMTDFY8saTjPp4a5FYj4gY=; 20:XEh7m9evw+CXb5ENpF17A3PRzkNbVZ2VmIWxsNL3mC1SqTkYAT2cPm9Rbub+VSInflIPWK06kphNkMCDOUfh+g== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Sep 2015 13:24:41.5544 (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: BL2PR03MB481 X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB116; 2:s+IFCrGIw7A+Ndj4iOD5YLh1kAz3DOYBcfWeN8PeNipB5r5lZmqex03PRIXA4KbpD+mhq8YZpVykA6V/yz2cyIktM9Ua5e9U2G2MrzX89sB9EsvPUPfvjIuvyKyNdd1i/NvKU7A1fzv1yKJresn0CHYyFtOO672DUirkT6Wo4FA=; 3:mUFQqFd15J/fG+Q+c/tlwWcYk8JblqeERUpAv+amWHyIv9AwhYhrISKxUf/IZiTF5oHusGiXXCih80zFNfVE4OKAELTRwAOvXScnaVz0Exgz8teGd9dG37NF2Jxma3SKqYSbELB4UCXjbrws2rEmwZvj2ZXB0d+sVXc83bpFyVISASs4ABgNBQUWILeQxqE7bZzev8XolfMYRLoKU9RgQ90HXp/doLPoerlk9SFYAjs=; 25:YJZ8v912G4MzCEZMN969I9rJEBjtSn4ar6XF/Kw0/oXdgrmH+WJXwRl8y7ClVw47HFbM2vCG3IZ/2QVmuwX1E2SnoHyfxTUvHUti+j3HnXKUMIAJ6Tw6eBYPyAbSGAnQ0hUsRc7cEYAhh0DIe5zzjN3bClZ1l3l1f/KZeNvy5Pe3VCXpANKPJPmve8n64bVRjBg+cEM+qOGPY3AdRRe2q4/2QWBii55Rv3C0V/dNSRYWTmfbSFUD02ec42PHalYRDmyGYkx+/Qey7x5XKYk1cA==; 23:jjzfp/XzFmxcJH/YZxZDw0u2sUeSutrMrTYC5Hz4O7789pFVRsMGyY2V1l9RHhjYXw0AYPFEmj96wzMEm8NFwK5O20NJfbc9BxWhVLb3V3glDJzdCDXXLta7ZupUapd7fOpnUpe9wV6k3R4GKgNwKJet/xzAdhWry5+fuoPuWABC8RHEb7CxRzzEQSJlp5QQ X-OriginatorOrg: freescale.com X-Topics: patch Cc: petri.savolainen@nokia.com, stuart.haslam@arm.com Subject: [lng-odp] [API NEXT PATCH v6 08/14] linux-generic: sysinfo: revise odp_cpu_hz() to return current 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.172 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 The odp_cpu_hz_max() is added to returm maximum frequency of CPU, while the odp_cpu_hz(), as shown by its name, should return current frequency of CPU, this patch revise odp_cpu_hz() for this purpose. Signed-off-by: Hongbo Zhang --- platform/linux-generic/odp_system_info.c | 56 +++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index 8532fa0..ed61d36 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -146,6 +146,42 @@ static int cpuinfo_x86(FILE *file, odp_system_info_t *sysinfo) return 0; } +static uint64_t arch_cpu_hz_current(int id) +{ + char str[1024]; + FILE *file; + int cpu; + char *pos; + double mhz = 0.0; + + file = fopen("/proc/cpuinfo", "rt"); + + /* find the correct processor instance */ + while (fgets(str, sizeof(str), file) != NULL) { + pos = strstr(str, "processor"); + if (pos) { + sscanf(pos, "processor : %d", &cpu); + if (cpu == id) + break; + } + } + + /* extract the cpu current speed */ + while (fgets(str, sizeof(str), file) != NULL) { + pos = strstr(str, "cpu MHz"); + if (pos) { + sscanf(pos, "cpu MHz : %lf", &mhz); + break; + } + } + + fclose(file); + if (mhz) + return (uint64_t)(mhz * 1000000.0); + + return -1; +} + #elif defined __arm__ || defined __aarch64__ static int cpuinfo_arm(FILE *file ODP_UNUSED, @@ -154,6 +190,11 @@ odp_system_info_t *sysinfo ODP_UNUSED) return 0; } +static uint64_t arch_cpu_hz_current(int id) +{ + return -1; +} + #elif defined __OCTEON__ static int cpuinfo_octeon(FILE *file, odp_system_info_t *sysinfo) @@ -195,6 +236,12 @@ static int cpuinfo_octeon(FILE *file, odp_system_info_t *sysinfo) return 0; } + +static uint64_t arch_cpu_hz_current(int id) +{ + return -1; +} + #elif defined __powerpc__ static int cpuinfo_powerpc(FILE *file, odp_system_info_t *sysinfo) { @@ -236,6 +283,11 @@ static int cpuinfo_powerpc(FILE *file, odp_system_info_t *sysinfo) return 0; } +static uint64_t arch_cpu_hz_current(int id) +{ + return -1; +} + #else #error GCC target not found #endif @@ -368,7 +420,9 @@ int odp_system_info_init(void) */ uint64_t odp_cpu_hz(void) { - return odp_global_data.system_info.cpu_hz[0]; + int id = sched_getcpu(); + + return arch_cpu_hz_current(id); } uint64_t odp_cpu_hz_max(void)