mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 14:44:34 +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,
|
||||
TracyPlotFormatMemory,
|
||||
TracyPlotFormatPercentage,
|
||||
TracyPlotFormatWatt
|
||||
};
|
||||
|
||||
TRACY_API void ___tracy_set_thread_name( const char* name );
|
||||
|
@ -726,7 +726,8 @@ enum class PlotType : uint8_t
|
||||
{
|
||||
User,
|
||||
Memory,
|
||||
SysTime
|
||||
SysTime,
|
||||
Power
|
||||
};
|
||||
|
||||
// Keep this in sync with enum in TracyC.h
|
||||
@ -734,7 +735,8 @@ enum class PlotValueFormatting : uint8_t
|
||||
{
|
||||
Number,
|
||||
Memory,
|
||||
Percentage
|
||||
Percentage,
|
||||
Watt
|
||||
};
|
||||
|
||||
struct PlotData
|
||||
|
@ -38,6 +38,9 @@ const char* TimelineItemPlot::HeaderLabel() const
|
||||
}
|
||||
case PlotType::SysTime:
|
||||
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:
|
||||
assert( false );
|
||||
return nullptr;
|
||||
|
@ -157,6 +157,8 @@ uint32_t GetPlotColor( const PlotData& plot, const Worker& worker )
|
||||
return 0xFF2266CC;
|
||||
case PlotType::SysTime:
|
||||
return 0xFFBAB220;
|
||||
case PlotType::Power:
|
||||
return 0xFF33CC33;
|
||||
default:
|
||||
assert( false );
|
||||
return 0;
|
||||
@ -177,6 +179,9 @@ const char* FormatPlotValue( double val, PlotValueFormatting format )
|
||||
case PlotValueFormatting::Percentage:
|
||||
sprintf( buf, "%.2f%%", val );
|
||||
break;
|
||||
case PlotValueFormatting::Watt:
|
||||
sprintf( buf, "%s W", RealToString( val ) );
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
|
@ -6698,8 +6698,8 @@ void Worker::ProcessSysPower( const QueueSysPower& ev )
|
||||
CheckString( ev.name );
|
||||
PlotData* plot = m_slab.AllocInit<PlotData>();
|
||||
plot->name = ev.name;
|
||||
plot->type = PlotType::User;
|
||||
plot->format = PlotValueFormatting::Number;
|
||||
plot->type = PlotType::Power;
|
||||
plot->format = PlotValueFormatting::Watt;
|
||||
plot->showSteps = false;
|
||||
plot->fill = true;
|
||||
plot->color = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user