blob: 9b22e836e2f6e28e7ced6174662c3d6c2e55f75d [file] [log] [blame]
niklase@google.comf0779a22011-05-30 11:39:38 +00001/*
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
16namespace webrtc {
17class CpuLinux : public CpuWrapper
18{
19public:
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;}
33private:
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_