-
Notifications
You must be signed in to change notification settings - Fork 482
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move preemption and clocks to examine as advanced reports
Signed-off-by: AShivangi <shivangiagarwal53@gmail.com>
- Loading branch information
Showing
9 changed files
with
178 additions
and
204 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
src/runtime_src/core/tools/common/reports/ReportClocks.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved. | ||
|
||
// ------ I N C L U D E F I L E S ------------------------------------------- | ||
// Local - Include Files | ||
#include "ReportClocks.h" | ||
#include "core/common/info_platform.h" | ||
#include "tools/common/Table2D.h" | ||
|
||
// 3rd Party Library - Include Files | ||
#include <vector> | ||
|
||
using bpt = boost::property_tree::ptree; | ||
|
||
void | ||
ReportClocks::getPropertyTreeInternal(const xrt_core::device* dev, | ||
bpt& pt) const | ||
{ | ||
// Defer to the 20202 format. If we ever need to update JSON data, | ||
// Then update this method to do so. | ||
getPropertyTree20202(dev, pt); | ||
} | ||
|
||
void | ||
ReportClocks::getPropertyTree20202(const xrt_core::device* dev, | ||
bpt& pt) const | ||
{ | ||
// There can only be 1 root node | ||
pt = xrt_core::platform::get_clock_info(dev); | ||
} | ||
|
||
void | ||
ReportClocks::writeReport(const xrt_core::device* /*_pDevice*/, | ||
const bpt& pt, | ||
const std::vector<std::string>& /*_elementsFilter*/, | ||
std::ostream& _output) const | ||
{ | ||
_output << "Clocks\n"; | ||
|
||
const bpt empty_ptree; | ||
const bpt& pt_clock_array = pt.get_child("clocks", empty_ptree); | ||
if (pt_clock_array.empty()) { | ||
_output << " No Clocks information available\n\n"; | ||
return; | ||
} | ||
|
||
//print clocks | ||
std::stringstream ss; | ||
for (const auto& kc : pt_clock_array) { | ||
const bpt& pt_clock = kc.second; | ||
ss << boost::format(" %-23s: %3s MHz\n") % pt_clock.get<std::string>("id") | ||
% pt_clock.get<std::string>("freq_mhz"); | ||
} | ||
std::cout << ss.str(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved. | ||
|
||
#ifndef __ReportClocks_h_ | ||
#define __ReportClocks_h_ | ||
|
||
// Please keep external include file dependencies to a minimum | ||
#include "tools/common/Report.h" | ||
|
||
class ReportClocks : public Report { | ||
public: | ||
ReportClocks() : Report("clocks", "Clocks data for the device", true /*deviceRequired*/) { /*empty*/ }; | ||
|
||
// Child methods that need to be implemented | ||
public: | ||
virtual void getPropertyTreeInternal(const xrt_core::device* dev, boost::property_tree::ptree& pt) const; | ||
virtual void getPropertyTree20202(const xrt_core::device* deve, boost::property_tree::ptree& pt) const; | ||
virtual void writeReport(const xrt_core::device* _pDevice, const boost::property_tree::ptree& _pt, const std::vector<std::string>& _elementsFilter, std::ostream& _output) const; | ||
}; | ||
|
||
#endif |
76 changes: 76 additions & 0 deletions
76
src/runtime_src/core/tools/common/reports/ReportPreemption.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved. | ||
|
||
// ------ I N C L U D E F I L E S ------------------------------------------- | ||
// Local - Include Files | ||
#include "ReportPreemption.h" | ||
#include "core/common/info_telemetry.h" | ||
#include "tools/common/Table2D.h" | ||
|
||
// 3rd Party Library - Include Files | ||
#include <vector> | ||
|
||
using bpt = boost::property_tree::ptree; | ||
|
||
void | ||
ReportPreemption::getPropertyTreeInternal(const xrt_core::device* dev, | ||
bpt& pt) const | ||
{ | ||
// Defer to the 20202 format. If we ever need to update JSON data, | ||
// Then update this method to do so. | ||
getPropertyTree20202(dev, pt); | ||
} | ||
|
||
void | ||
ReportPreemption::getPropertyTree20202(const xrt_core::device* dev, | ||
bpt& pt) const | ||
{ | ||
// There can only be 1 root node | ||
pt = xrt_core::telemetry::preemption_telemetry_info(dev); | ||
} | ||
|
||
static std::string | ||
generate_preemption_string(const bpt& pt) | ||
{ | ||
std::stringstream ss; | ||
|
||
std::vector<Table2D::HeaderData> preempt_headers = { | ||
{"User Task", Table2D::Justification::left}, | ||
{"Ctx ID", Table2D::Justification::left}, | ||
{"Layer Boundary Events", Table2D::Justification::left}, | ||
{"Frame Boundary Events", Table2D::Justification::left}, | ||
}; | ||
Table2D preemption_table(preempt_headers); | ||
|
||
for (const auto& [name, user_task] : pt) { | ||
const std::vector<std::string> rtos_data = { | ||
user_task.get<std::string>("user_task"), | ||
user_task.get<std::string>("slot_index"), | ||
user_task.get<std::string>("preemption_layer_boundary_events"), | ||
user_task.get<std::string>("preemption_frame_boundary_events"), | ||
}; | ||
preemption_table.addEntry(rtos_data); | ||
} | ||
|
||
ss << preemption_table.toString(" ") << "\n"; | ||
|
||
return ss.str(); | ||
} | ||
|
||
void | ||
ReportPreemption::writeReport(const xrt_core::device* , | ||
const bpt& pt, | ||
const std::vector<std::string>&, | ||
std::ostream& _output) const | ||
{ | ||
const bpt empty_ptree; | ||
bpt telemetry_array = pt.get_child("telemetry", empty_ptree); | ||
_output << "Premption Telemetry Data\n"; | ||
if (telemetry_array.empty()) { | ||
_output << " No hardware contexts running on device\n\n"; | ||
return; | ||
} | ||
|
||
_output << generate_preemption_string(telemetry_array); | ||
_output << std::endl; | ||
} |
21 changes: 21 additions & 0 deletions
21
src/runtime_src/core/tools/common/reports/ReportPreemption.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved. | ||
|
||
#ifndef __ReportPreemption_h_ | ||
#define __ReportPreemption_h_ | ||
|
||
// Please keep external include file dependencies to a minimum | ||
#include "tools/common/Report.h" | ||
|
||
class ReportPreemption : public Report { | ||
public: | ||
ReportPreemption() : Report("preemption", "Preemption data for the device", true /*deviceRequired*/) { /*empty*/ }; | ||
|
||
// Child methods that need to be implemented | ||
public: | ||
virtual void getPropertyTreeInternal(const xrt_core::device* dev, boost::property_tree::ptree& pt) const; | ||
virtual void getPropertyTree20202(const xrt_core::device* deve, boost::property_tree::ptree& pt) const; | ||
virtual void writeReport(const xrt_core::device* _pDevice, const boost::property_tree::ptree& _pt, const std::vector<std::string>& _elementsFilter, std::ostream& _output) const; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.