Files
minecraft-pe-0.6.1/src/util/PerfTimer.h
Shredder e346df682c Another Huge Commit my bad - shredder
Restored Java's Debug Screen using partial unused code and ported code, avaliable in options menu as a style

Slight Water texture is now overlayed when in water

Vignette function has been fixed and can now be toggled in options

World Generation now includes Tall Grass and Ferns both

Broken Frame Chart Graph found in the source has now been fixed and enabled when debug screen is turned on

Pie Chart works now and will appear when debug screen is opened

Most changes have not been tested on anything besides windows, will test it
2026-05-04 01:28:27 +05:00

69 lines
1.8 KiB
C++
Executable File

#ifndef NET_UTIL__PerfTimer_H__
#define NET_UTIL__PerfTimer_H__
#include <map>
#include <vector>
#include "StringUtils.h"
//package util;
//#ifdef PROFILER
#define TIMER_PUSH(x) PerfTimer::push(x)
#define TIMER_POP() PerfTimer::pop()
#define TIMER_POP_PUSH(x) PerfTimer::popPush(x)
// #elif defined(SERVER_PROFILER)
// #include "ServerProfiler.h"
// #define TIMER_PUSH(x) ServerProfiler::push(x)
// #define TIMER_POP() ServerProfiler::pop()
// #define TIMER_POP_PUSH(x) ServerProfiler::popPush(x)
//#else
// #define TIMER_PUSH(x) ((void*)0)
// #define TIMER_POP() ((void*)0)
// #define TIMER_POP_PUSH(x) ((void*)0)
//#endif
class PerfTimer
{
typedef std::map<std::string, float> TimeMap;
public:
class ResultField {
public:
float percentage;
float globalPercentage;
std::string name;
ResultField(const std::string& name, float percentage, float globalPercentage)
: name(name),
percentage(percentage),
globalPercentage(globalPercentage)
{}
bool operator<(const ResultField& rf) const {
if (percentage != rf.percentage)
return percentage > rf.percentage;
return name > rf.name;
}
int getColor() const {
return (Util::hashCode(name) & 0xaaaaaa) + 0x444444;
}
};
static void reset();
static void push(const std::string& name);
static void pop();
static void popPush(const std::string& name);
static std::vector<ResultField> getLog(const std::string& path);
static bool enabled;
private:
static std::vector<std::string> paths;
static std::vector<float> startTimes;
static std::string path;
static TimeMap times;
};
#endif /*NET_UTIL__PerfTimer_H__*/