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_MAC_H_
     12 #define WEBRTC_SYSTEM_WRAPPERS_SOURCE_CPU_MAC_H_
     13 
     14 #include "cpu_wrapper.h"
     15 
     16 namespace webrtc {
     17 class CpuWrapperMac : public CpuWrapper
     18 {
     19 public:
     20     CpuWrapperMac();
     21     virtual ~CpuWrapperMac();
     22 
     23     virtual WebRtc_Word32 CpuUsage();
     24     virtual WebRtc_Word32 CpuUsage(WebRtc_Word8* /*pProcessName*/,
     25                                    WebRtc_UWord32 /*length*/) {return -1;}
     26     virtual WebRtc_Word32 CpuUsage(WebRtc_UWord32  /*dwProcessID*/) {return -1;}
     27 
     28     // Note: this class will block the call and sleep if called too fast
     29     // This function blocks the calling thread if the thread is calling it more
     30     // often than every 500 ms.
     31     virtual WebRtc_Word32 CpuUsageMultiCore(WebRtc_UWord32& numCores,
     32                                             WebRtc_UWord32*& array);
     33 
     34     virtual void Reset() {}
     35     virtual void Stop() {}
     36 
     37 private:
     38     WebRtc_UWord32* _cpuUsage;
     39     WebRtc_Word64*  _lastTickCount;
     40     WebRtc_Word64   _lastTime;
     41 };
     42 } // namespace webrtc
     43 
     44 #endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_CPU_MAC_H_
     45