QoL Changes
fix timetrace last diff
This commit is contained in:
@@ -30,7 +30,7 @@ namespace PD {
|
|||||||
* Class to calculate Maximum/Minimum and Average Timings
|
* Class to calculate Maximum/Minimum and Average Timings
|
||||||
*/
|
*/
|
||||||
class TimeStats {
|
class TimeStats {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Constructor taking a lengh for the List
|
* Constructor taking a lengh for the List
|
||||||
* @param l Lengh of the data list
|
* @param l Lengh of the data list
|
||||||
@@ -55,8 +55,7 @@ public:
|
|||||||
* @return Average
|
* @return Average
|
||||||
*/
|
*/
|
||||||
u64 GetAverage() {
|
u64 GetAverage() {
|
||||||
if (!num_val)
|
if (!num_val) return 0.f;
|
||||||
return 0.f;
|
|
||||||
u64 res = 0;
|
u64 res = 0;
|
||||||
for (int i = 0; i < num_val; i++) {
|
for (int i = 0; i < num_val; i++) {
|
||||||
res += val[smart_idx(i)];
|
res += val[smart_idx(i)];
|
||||||
@@ -69,8 +68,7 @@ public:
|
|||||||
* @return Minimum value
|
* @return Minimum value
|
||||||
*/
|
*/
|
||||||
u64 GetMin() {
|
u64 GetMin() {
|
||||||
if (!num_val)
|
if (!num_val) return 0.f;
|
||||||
return 0.f;
|
|
||||||
u64 res = std::numeric_limits<u64>::max();
|
u64 res = std::numeric_limits<u64>::max();
|
||||||
for (int i = 0; i < num_val; i++) {
|
for (int i = 0; i < num_val; i++) {
|
||||||
res = std::min(val[smart_idx(i)], res);
|
res = std::min(val[smart_idx(i)], res);
|
||||||
@@ -83,8 +81,7 @@ public:
|
|||||||
* @return Max Value
|
* @return Max Value
|
||||||
*/
|
*/
|
||||||
u64 GetMax() {
|
u64 GetMax() {
|
||||||
if (!num_val)
|
if (!num_val) return 0.f;
|
||||||
return 0.f;
|
|
||||||
u64 res = 0;
|
u64 res = 0;
|
||||||
for (int i = 0; i < num_val; i++) {
|
for (int i = 0; i < num_val; i++) {
|
||||||
res = std::max(val[smart_idx(i)], res);
|
res = std::max(val[smart_idx(i)], res);
|
||||||
@@ -122,7 +119,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
const size_t GetNumValues() { return num_val; }
|
const size_t GetNumValues() { return num_val; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Get the Next Position to write to
|
* Get the Next Position to write to
|
||||||
* @param c current position
|
* @param c current position
|
||||||
@@ -152,7 +149,7 @@ namespace TT {
|
|||||||
* Data Structure for a TimeTrace Result
|
* Data Structure for a TimeTrace Result
|
||||||
*/
|
*/
|
||||||
class Res {
|
class Res {
|
||||||
public:
|
public:
|
||||||
/** Constructore that Inits a protocol at size of 60 frames */
|
/** Constructore that Inits a protocol at size of 60 frames */
|
||||||
Res() : start(0), end(0) { protocol = TimeStats::New(60); }
|
Res() : start(0), end(0) { protocol = TimeStats::New(60); }
|
||||||
~Res() = default;
|
~Res() = default;
|
||||||
@@ -185,6 +182,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
void SetEnd(u64 v) {
|
void SetEnd(u64 v) {
|
||||||
end = v;
|
end = v;
|
||||||
|
diff = end - start;
|
||||||
protocol->Add(GetLastDiff());
|
protocol->Add(GetLastDiff());
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -197,20 +195,22 @@ public:
|
|||||||
* Get Last Diffrence between end and start
|
* Get Last Diffrence between end and start
|
||||||
* @return end - start
|
* @return end - start
|
||||||
*/
|
*/
|
||||||
u64 GetLastDiff() { return end - start; }
|
u64 GetLastDiff() { return diff; }
|
||||||
/**
|
/**
|
||||||
* Get Protcol Reference
|
* Get Protcol Reference
|
||||||
* @return Protocol Ref
|
* @return Protocol Ref
|
||||||
*/
|
*/
|
||||||
TimeStats::Ref GetProtocol() { return protocol; }
|
TimeStats::Ref GetProtocol() { return protocol; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Trace ID */
|
/** Trace ID */
|
||||||
std::string id;
|
std::string id;
|
||||||
/** Start time */
|
/** Start time */
|
||||||
u64 start;
|
u64 start;
|
||||||
/** End Time */
|
/** End Time */
|
||||||
u64 end;
|
u64 end;
|
||||||
|
/** Last Diff */
|
||||||
|
u64 diff;
|
||||||
/** Protocol */
|
/** Protocol */
|
||||||
TimeStats::Ref protocol;
|
TimeStats::Ref protocol;
|
||||||
};
|
};
|
||||||
@@ -240,7 +240,7 @@ PD_CORE_API void End(const std::string &id);
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
class Scope {
|
class Scope {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Constructor requiring a Name for the Trace
|
* Constructor requiring a Name for the Trace
|
||||||
* @param id Name of the Trace
|
* @param id Name of the Trace
|
||||||
@@ -254,7 +254,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
~Scope() { End(ID); }
|
~Scope() { End(ID); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Trace Name/ID */
|
/** Trace Name/ID */
|
||||||
std::string ID;
|
std::string ID;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ class Gfx {
|
|||||||
|
|
||||||
static void BindTex(Li::TexAddress addr) { pGfx->BindTex(addr); }
|
static void BindTex(Li::TexAddress addr) { pGfx->BindTex(addr); }
|
||||||
static void SetViewPort(const ivec2& vp) { pGfx->SetViewPort(vp); }
|
static void SetViewPort(const ivec2& vp) { pGfx->SetViewPort(vp); }
|
||||||
|
static void SetViewPort(int w, int h) { pGfx->SetViewPort(PD::ivec2(w, h);) }
|
||||||
|
|
||||||
static void RenderDrawData(const std::vector<Li::Command::Ref>& Commands) {
|
static void RenderDrawData(const std::vector<Li::Command::Ref>& Commands) {
|
||||||
pGfx->RenderDrawData(Commands);
|
pGfx->RenderDrawData(Commands);
|
||||||
|
|||||||
@@ -40,6 +40,12 @@ class Command {
|
|||||||
IndexBuffer.push_back(VertexBuffer.size() + idx);
|
IndexBuffer.push_back(VertexBuffer.size() + idx);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
Command& AddIdxs(const u16& a, const u16& b, const u16& c) {
|
||||||
|
IndexBuffer.push_back(VertexBuffer.size() + a);
|
||||||
|
IndexBuffer.push_back(VertexBuffer.size() + b);
|
||||||
|
IndexBuffer.push_back(VertexBuffer.size() + c);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
Command& AddVtx(const Vertex& v) {
|
Command& AddVtx(const Vertex& v) {
|
||||||
VertexBuffer.push_back(std::move(v));
|
VertexBuffer.push_back(std::move(v));
|
||||||
|
|||||||
@@ -68,6 +68,12 @@ class PD_LITHIUM_API DrawList {
|
|||||||
* @param list DrawList to move into current
|
* @param list DrawList to move into current
|
||||||
*/
|
*/
|
||||||
void Merge(DrawList::Ref list);
|
void Merge(DrawList::Ref list);
|
||||||
|
/**
|
||||||
|
* Copy another drawlist to this drawist.
|
||||||
|
* This is important for static prerendered Drawlists
|
||||||
|
* @param list DrawList Reference to copy from
|
||||||
|
*/
|
||||||
|
void Copy(DrawList::Ref list);
|
||||||
/**
|
/**
|
||||||
* Optimize a Drawlist to a more or less perfect order
|
* Optimize a Drawlist to a more or less perfect order
|
||||||
* to reduce drawcall overhead... This function also uses
|
* to reduce drawcall overhead... This function also uses
|
||||||
@@ -80,6 +86,8 @@ class PD_LITHIUM_API DrawList {
|
|||||||
void Clear();
|
void Clear();
|
||||||
void Layer(int l) { this->pLayer = l; }
|
void Layer(int l) { this->pLayer = l; }
|
||||||
int Layer() { return this->pLayer; }
|
int Layer() { return this->pLayer; }
|
||||||
|
void LayerUp() { this->pLayer++; }
|
||||||
|
void LayerDown() { this->pLayer--; }
|
||||||
|
|
||||||
void SetFont(Font::Ref font) { pCurrentFont = font; }
|
void SetFont(Font::Ref font) { pCurrentFont = font; }
|
||||||
void SetFontScale(float scale) { pFontScale = scale; }
|
void SetFontScale(float scale) { pFontScale = scale; }
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.22)
|
cmake_minimum_required(VERSION 3.22)
|
||||||
|
|
||||||
## The Core Core Library
|
## The Core Core Library
|
||||||
project(pd-drivers LANGUAGES CXX VERSION 0.5.1)
|
project(pd-drivers LANGUAGES CXX VERSION 0.6.0)
|
||||||
|
|
||||||
set(SRC
|
set(SRC
|
||||||
source/hid.cpp
|
source/hid.cpp
|
||||||
|
|||||||
Reference in New Issue
Block a user