Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
PerfCounterMng.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* PerfCounterMng.cc (C) 2000-2017 */
9/* */
10/* */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/ArcanePrecomp.h"
15#include "arcane/utils/PerfCounterMng.h"
16
17#include <iostream>
18
19/*---------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22ARCANE_BEGIN_NAMESPACE
23
24/*---------------------------------------------------------------------------*/
25/*---------------------------------------------------------------------------*/
26
33extern "C++" int
35{
36#ifndef WIN32
37 /* return cpu frequency in MHZ as read in /proc/cpuinfo */
38 float ffreq = 0;
39 int r = 0;
40 char *rr = NULL;
41 FILE *fdes = fopen("/proc/cpuinfo","r");
42 char buff[256];
43 int bufflength = 256;
44 do{
46 r = sscanf(buff,"cpu MHz : %f\n",&ffreq);
47 if(r==1){
48 break;
49 }
50 } while(rr != NULL);
51
52 fclose(fdes);
53
54 int ifreq = (int)ffreq;
55 return ifreq;
56#else
57 std::cerr << "getCpuFreq not functionnal under win\n";
58 return 1;
59#endif
60}
61
62/*---------------------------------------------------------------------------*/
63/*---------------------------------------------------------------------------*/
64
65ARCANE_END_NAMESPACE
66
67/*---------------------------------------------------------------------------*/
68/*---------------------------------------------------------------------------*/
69
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
int arcaneGetCpuBaseFrequency()
Retourne la fréquence du CPU en Mhz.