mirror of
https://github.com/wolfpld/tracy
synced 2025-05-02 21:53:52 +00:00
Add plot type "power" and Watt format.
Note that this technically breaks backwards compatibility of trace files for 0.9.2 builds. But, whatever, as it's not yet released.
This commit is contained in:
parent
23705fd84c
commit
7d69103444
@ -16,6 +16,7 @@ enum TracyPlotFormatEnum
|
|||||||
TracyPlotFormatNumber,
|
TracyPlotFormatNumber,
|
||||||
TracyPlotFormatMemory,
|
TracyPlotFormatMemory,
|
||||||
TracyPlotFormatPercentage,
|
TracyPlotFormatPercentage,
|
||||||
|
TracyPlotFormatWatt
|
||||||
};
|
};
|
||||||
|
|
||||||
TRACY_API void ___tracy_set_thread_name( const char* name );
|
TRACY_API void ___tracy_set_thread_name( const char* name );
|
||||||
|
@ -726,7 +726,8 @@ enum class PlotType : uint8_t
|
|||||||
{
|
{
|
||||||
User,
|
User,
|
||||||
Memory,
|
Memory,
|
||||||
SysTime
|
SysTime,
|
||||||
|
Power
|
||||||
};
|
};
|
||||||
|
|
||||||
// Keep this in sync with enum in TracyC.h
|
// Keep this in sync with enum in TracyC.h
|
||||||
@ -734,7 +735,8 @@ enum class PlotValueFormatting : uint8_t
|
|||||||
{
|
{
|
||||||
Number,
|
Number,
|
||||||
Memory,
|
Memory,
|
||||||
Percentage
|
Percentage,
|
||||||
|
Watt
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PlotData
|
struct PlotData
|
||||||
|
@ -38,6 +38,9 @@ const char* TimelineItemPlot::HeaderLabel() const
|
|||||||
}
|
}
|
||||||
case PlotType::SysTime:
|
case PlotType::SysTime:
|
||||||
return ICON_FA_GAUGE_HIGH " CPU usage";
|
return ICON_FA_GAUGE_HIGH " CPU usage";
|
||||||
|
case PlotType::Power:
|
||||||
|
sprintf( tmp, ICON_FA_BOLT " %s", m_worker.GetString( m_plot->name ) );
|
||||||
|
return tmp;
|
||||||
default:
|
default:
|
||||||
assert( false );
|
assert( false );
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -157,6 +157,8 @@ uint32_t GetPlotColor( const PlotData& plot, const Worker& worker )
|
|||||||
return 0xFF2266CC;
|
return 0xFF2266CC;
|
||||||
case PlotType::SysTime:
|
case PlotType::SysTime:
|
||||||
return 0xFFBAB220;
|
return 0xFFBAB220;
|
||||||
|
case PlotType::Power:
|
||||||
|
return 0xFF33CC33;
|
||||||
default:
|
default:
|
||||||
assert( false );
|
assert( false );
|
||||||
return 0;
|
return 0;
|
||||||
@ -177,6 +179,9 @@ const char* FormatPlotValue( double val, PlotValueFormatting format )
|
|||||||
case PlotValueFormatting::Percentage:
|
case PlotValueFormatting::Percentage:
|
||||||
sprintf( buf, "%.2f%%", val );
|
sprintf( buf, "%.2f%%", val );
|
||||||
break;
|
break;
|
||||||
|
case PlotValueFormatting::Watt:
|
||||||
|
sprintf( buf, "%s W", RealToString( val ) );
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
assert( false );
|
assert( false );
|
||||||
break;
|
break;
|
||||||
|
@ -6698,8 +6698,8 @@ void Worker::ProcessSysPower( const QueueSysPower& ev )
|
|||||||
CheckString( ev.name );
|
CheckString( ev.name );
|
||||||
PlotData* plot = m_slab.AllocInit<PlotData>();
|
PlotData* plot = m_slab.AllocInit<PlotData>();
|
||||||
plot->name = ev.name;
|
plot->name = ev.name;
|
||||||
plot->type = PlotType::User;
|
plot->type = PlotType::Power;
|
||||||
plot->format = PlotValueFormatting::Number;
|
plot->format = PlotValueFormatting::Watt;
|
||||||
plot->showSteps = false;
|
plot->showSteps = false;
|
||||||
plot->fill = true;
|
plot->fill = true;
|
||||||
plot->color = 0;
|
plot->color = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user