Home | History | Annotate | Download | only in source
      1 /*
      2  *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
      3  *
      4  *  Use of this source code is governed by a BSD-style license
      5  *  that can be found in the LICENSE file in the root of the source
      6  *  tree. An additional intellectual property rights grant can be found
      7  *  in the file PATENTS.  All contributing project authors may
      8  *  be found in the AUTHORS file in the root of the source tree.
      9  */
     10 
     11 #ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_CPU_LINUX_H_
     12 #define WEBRTC_SYSTEM_WRAPPERS_SOURCE_CPU_LINUX_H_
     13 
     14 #include "cpu_wrapper.h"
     15 
     16 namespace webrtc {
     17 class CpuLinux : public CpuWrapper
     18 {
     19 public:
     20     CpuLinux();
     21     virtual ~CpuLinux();
     22 
     23     virtual WebRtc_Word32 CpuUsage();
     24     virtual WebRtc_Word32 CpuUsage(WebRtc_Word8* /*pProcessName*/,
     25                                    WebRtc_UWord32 /*length*/) {return 0;}
     26     virtual WebRtc_Word32 CpuUsage(WebRtc_UWord32 /*dwProcessID*/) {return 0;}
     27 
     28     virtual WebRtc_Word32 CpuUsageMultiCore(WebRtc_UWord32& numCores,
     29                                             WebRtc_UWord32*& array);
     30 
     31     virtual void Reset() {return;}
     32     virtual void Stop() {return;}
     33 private:
     34     int GetData(long long& busy, long long& idle, long long*& busyArray,
     35                 long long*& idleArray);
     36     int GetNumCores();
     37 
     38     long long m_oldBusyTime;
     39     long long m_oldIdleTime;
     40 
     41     long long* m_oldBusyTimeMulti;
     42     long long* m_oldIdleTimeMulti;
     43 
     44     long long* m_idleArray;
     45     long long* m_busyArray;
     46     WebRtc_UWord32* m_resultArray;
     47     WebRtc_UWord32  m_numCores;
     48 };
     49 } // namespace webrtc
     50 
     51 #endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_CPU_LINUX_H_
     52