mirror of
https://github.com/wolfpld/tracy
synced 2025-04-30 12:53:51 +00:00
make it easier to see the diff
Signed-off-by: Liao <dezhliao@amd.com>
This commit is contained in:
parent
e19a823c37
commit
4662be3aac
@ -253,8 +253,68 @@ int main(int argc, char** argv)
|
|||||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!args.show_gpu)
|
if (args.show_gpu)
|
||||||
{
|
{
|
||||||
|
auto& gpu_slz = worker.GetGpuSourceLocationZones();
|
||||||
|
tracy::Vector<decltype( gpu_slz.begin() )> gpu_slz_selected;
|
||||||
|
gpu_slz_selected.reserve( gpu_slz.size() );
|
||||||
|
|
||||||
|
uint32_t total_cnt = 0;
|
||||||
|
for (auto it = gpu_slz.begin(); it != gpu_slz.end(); ++it)
|
||||||
|
{
|
||||||
|
if (it->second.total != 0)
|
||||||
|
{
|
||||||
|
++total_cnt;
|
||||||
|
if (args.filter[0] == '\0')
|
||||||
|
{
|
||||||
|
gpu_slz_selected.push_back_no_space_check( it );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto name = get_name( it->first, worker );
|
||||||
|
if (is_substring( args.filter, name, args.case_sensitive))
|
||||||
|
{
|
||||||
|
gpu_slz_selected.push_back_no_space_check( it );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<const char*> columns;
|
||||||
|
columns = {"name", "src_file", "Time from start of program", "GPU execution time"};
|
||||||
|
|
||||||
|
std::string header = join(columns, args.separator);
|
||||||
|
printf("%s\n", header.data());
|
||||||
|
|
||||||
|
const auto last_time = worker.GetLastTime();
|
||||||
|
for (auto& it : gpu_slz_selected)
|
||||||
|
{
|
||||||
|
std::vector<std::string> values( columns.size() );
|
||||||
|
|
||||||
|
values[0] = get_name( it->first, worker );
|
||||||
|
|
||||||
|
const auto& srcloc = worker.GetSourceLocation( it->first );
|
||||||
|
values[1] = worker.GetString( srcloc.file );
|
||||||
|
|
||||||
|
const auto& zone_data = it->second;
|
||||||
|
for (const auto& zone_thread_data : zone_data.zones)
|
||||||
|
{
|
||||||
|
tracy::GpuEvent* gpu_event = zone_thread_data.Zone();
|
||||||
|
const auto start = gpu_event->GpuStart();
|
||||||
|
const auto end = gpu_event->GpuEnd();
|
||||||
|
|
||||||
|
values[2] = std::to_string( start );
|
||||||
|
|
||||||
|
auto timespan = end - start;
|
||||||
|
values[3] = std::to_string( timespan );
|
||||||
|
|
||||||
|
std::string row = join( values, args.separator );
|
||||||
|
printf( "%s\n", row.data() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
auto& slz = worker.GetSourceLocationZones();
|
auto& slz = worker.GetSourceLocationZones();
|
||||||
tracy::Vector<decltype(slz.begin())> slz_selected;
|
tracy::Vector<decltype(slz.begin())> slz_selected;
|
||||||
slz_selected.reserve(slz.size());
|
slz_selected.reserve(slz.size());
|
||||||
@ -383,67 +443,6 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else // only show gpu event statistics
|
|
||||||
{
|
|
||||||
auto& gpu_slz = worker.GetGpuSourceLocationZones();
|
|
||||||
tracy::Vector<decltype( gpu_slz.begin() )> gpu_slz_selected;
|
|
||||||
gpu_slz_selected.reserve( gpu_slz.size() );
|
|
||||||
|
|
||||||
uint32_t total_cnt = 0;
|
|
||||||
for (auto it = gpu_slz.begin(); it != gpu_slz.end(); ++it)
|
|
||||||
{
|
|
||||||
if (it->second.total != 0)
|
|
||||||
{
|
|
||||||
++total_cnt;
|
|
||||||
if (args.filter[0] == '\0')
|
|
||||||
{
|
|
||||||
gpu_slz_selected.push_back_no_space_check( it );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
auto name = get_name( it->first, worker );
|
|
||||||
if (is_substring( args.filter, name, args.case_sensitive))
|
|
||||||
{
|
|
||||||
gpu_slz_selected.push_back_no_space_check( it );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<const char*> columns;
|
|
||||||
columns = {"name", "src_file", "Time from start of program", "GPU execution time"};
|
|
||||||
|
|
||||||
std::string header = join(columns, args.separator);
|
|
||||||
printf("%s\n", header.data());
|
|
||||||
|
|
||||||
const auto last_time = worker.GetLastTime();
|
|
||||||
for (auto& it : gpu_slz_selected)
|
|
||||||
{
|
|
||||||
std::vector<std::string> values( columns.size() );
|
|
||||||
|
|
||||||
values[0] = get_name( it->first, worker );
|
|
||||||
|
|
||||||
const auto& srcloc = worker.GetSourceLocation( it->first );
|
|
||||||
values[1] = worker.GetString( srcloc.file );
|
|
||||||
|
|
||||||
const auto& zone_data = it->second;
|
|
||||||
for (const auto& zone_thread_data : zone_data.zones)
|
|
||||||
{
|
|
||||||
tracy::GpuEvent* gpu_event = zone_thread_data.Zone();
|
|
||||||
const auto start = gpu_event->GpuStart();
|
|
||||||
const auto end = gpu_event->GpuEnd();
|
|
||||||
|
|
||||||
values[2] = std::to_string( start );
|
|
||||||
|
|
||||||
auto timespan = end - start;
|
|
||||||
values[3] = std::to_string( timespan );
|
|
||||||
|
|
||||||
std::string row = join( values, args.separator );
|
|
||||||
printf( "%s\n", row.data() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user