changed: update version strings for beta4
[xbmc.git] / xbmc / utils / PerformanceStats.h
blob74c63846ad5899961e6e8e4e78200bde05c2a9fe
1 #ifndef PERFORMANCESTATS_H
2 #define PERFORMANCESTATS_H
4 /*
5 * Copyright (C) 2005-2008 Team XBMC
6 * http://www.xbmc.org
8 * This Program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * any later version.
13 * This Program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with XBMC; see the file COPYING. If not, write to
20 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
21 * http://www.gnu.org/copyleft/gpl.html
25 #include <map>
26 #include <string>
27 #include "PlatformDefs.h"
28 #include "CriticalSection.h"
30 class PerformanceCounter
32 public:
33 double m_time;
34 double m_user;
35 double m_sys;
36 __int64 m_samples;
38 PerformanceCounter(double dTime=0.0, double dUser=0.0, double dSys=0.0, __int64 nSamples=1LL) :
39 m_time(dTime), m_user(dUser), m_sys(dSys), m_samples(nSamples) { }
40 virtual ~PerformanceCounter() { }
43 /**
45 class CPerformanceStats{
46 public:
47 CPerformanceStats();
48 virtual ~CPerformanceStats();
50 void AddSample(const std::string &strStatName, const PerformanceCounter &perf);
51 void AddSample(const std::string &strStatName, double dTime);
52 void DumpStats();
54 protected:
55 CCriticalSection m_lock;
56 std::map<std::string, PerformanceCounter*> m_mapStats;
59 #endif