2011-07-07 10:21:25 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
*/
|
|
|
|
|
2011-11-29 03:39:28 +01:00
|
|
|
// ViEPerformanceMonitor is used to check the current CPU usage and triggers a
|
|
|
|
// callback when getting over a specified threshold.
|
2011-07-07 10:21:25 +02:00
|
|
|
|
2011-11-29 03:39:28 +01:00
|
|
|
#ifndef WEBRTC_VIDEO_ENGINE_VIE_PERFORMANCE_MONITOR_H_
|
|
|
|
#define WEBRTC_VIDEO_ENGINE_VIE_PERFORMANCE_MONITOR_H_
|
2011-07-07 10:21:25 +02:00
|
|
|
|
2011-12-22 15:17:53 +01:00
|
|
|
#include "system_wrappers/interface/scoped_ptr.h"
|
2011-07-07 10:21:25 +02:00
|
|
|
#include "typedefs.h"
|
2011-11-29 03:39:28 +01:00
|
|
|
#include "vie_defines.h"
|
|
|
|
|
|
|
|
namespace webrtc {
|
2011-07-07 10:21:25 +02:00
|
|
|
|
|
|
|
class CriticalSectionWrapper;
|
|
|
|
class CpuWrapper;
|
|
|
|
class EventWrapper;
|
|
|
|
class ThreadWrapper;
|
|
|
|
class ViEBaseObserver;
|
|
|
|
|
2011-11-29 03:39:28 +01:00
|
|
|
class ViEPerformanceMonitor {
|
|
|
|
public:
|
|
|
|
explicit ViEPerformanceMonitor(int engine_id);
|
|
|
|
~ViEPerformanceMonitor();
|
|
|
|
|
|
|
|
int Init(ViEBaseObserver* vie_base_observer);
|
|
|
|
void Terminate();
|
|
|
|
bool ViEBaseObserverRegistered();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
static bool ViEMonitorThreadFunction(void* obj);
|
|
|
|
bool ViEMonitorProcess();
|
|
|
|
|
|
|
|
private:
|
|
|
|
const int engine_id_;
|
2011-12-22 15:17:53 +01:00
|
|
|
// TODO(mfldoman) Make this one scoped_ptr.
|
|
|
|
CriticalSectionWrapper* pointer_cs_;
|
2011-11-29 03:39:28 +01:00
|
|
|
ThreadWrapper* monitor_thread_;
|
|
|
|
EventWrapper& monitor_event_;
|
|
|
|
int average_application_cpu_;
|
|
|
|
int average_system_cpu_;
|
|
|
|
CpuWrapper* cpu_;
|
|
|
|
ViEBaseObserver* vie_base_observer_;
|
2011-07-07 10:21:25 +02:00
|
|
|
};
|
2011-11-29 03:39:28 +01:00
|
|
|
|
|
|
|
} // namespace webrtc
|
|
|
|
|
|
|
|
#endif // WEBRTC_VIDEO_ENGINE_VIE_PERFORMANCE_MONITOR_H_
|