unordered metrics expressions config
Change-Id: I998423046abfd7af45f28071911276cce1c4f3da
[ROCm/rocprofiler commit: e5b938b5fb]
Cette révision appartient à :
@@ -81,6 +81,7 @@ fatal() {
|
||||
echo "$0: Error: $1"
|
||||
echo ""
|
||||
usage
|
||||
exit 1
|
||||
}
|
||||
|
||||
error() {
|
||||
@@ -409,11 +410,13 @@ if [ -n "$csv_output" ] ; then
|
||||
rm -f $csv_output
|
||||
fi
|
||||
|
||||
RET=0
|
||||
for name in $input_list; do
|
||||
run $name $OUTPUT_DIR $APP_CMD
|
||||
if [ -n "$ROCPROFILER_SESS" -a -e "$ROCPROFILER_SESS/error" ] ; then
|
||||
echo "Error found, profiling aborted."
|
||||
csv_output=""
|
||||
RET=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
@@ -439,4 +442,4 @@ if [ "$DATA_PATH" = "$TMP_DIR" ] ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
exit $RET
|
||||
|
||||
@@ -30,12 +30,14 @@ THE SOFTWARE.
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include "core/types.h"
|
||||
#include "util/exception.h"
|
||||
#include "util/hsa_rsrc_factory.h"
|
||||
#include "util/logger.h"
|
||||
#include "xml/expr.h"
|
||||
#include "xml/xml.h"
|
||||
|
||||
@@ -212,9 +214,16 @@ class MetricsDict {
|
||||
}
|
||||
|
||||
void ImportMetrics(const util::AgentInfo* agent_info, const std::string& scope) {
|
||||
auto metrics_list = xml_->GetNodes("top." + scope + ".metric");
|
||||
auto arr = xml_->GetNodes("top." + scope + ".metric");
|
||||
xml::Xml::node_list_t metrics_list(arr.begin(), arr.end());
|
||||
uint32_t metrics_number = metrics_list.size();
|
||||
bool do_lookup = true;
|
||||
if (!metrics_list.empty()) {
|
||||
for (auto node : metrics_list) {
|
||||
uint32_t it_number = metrics_number;
|
||||
auto it = metrics_list.begin();
|
||||
auto end = metrics_list.end();
|
||||
while (it != end) {
|
||||
auto node = *it;
|
||||
const std::string name = node->opts["name"];
|
||||
const std::string expr_str = node->opts["expr"];
|
||||
std::string descr = node->opts["descr"];
|
||||
@@ -244,20 +253,41 @@ class MetricsDict {
|
||||
AddMetric(name, alias, counter);
|
||||
}
|
||||
} else {
|
||||
xml::Expr* expr_obj = new xml::Expr(expr_str, new ExprCache(&cache_));
|
||||
#if 0
|
||||
std::cout << "# " << descr << std::endl;
|
||||
std::cout << name << "=" << expr_obj->String() << "\n" << std::endl;
|
||||
#endif
|
||||
counters_vec_t counters_vec;
|
||||
for (const std::string var : expr_obj->GetVars()) {
|
||||
auto it = cache_.find(var);
|
||||
if (it == cache_.end())
|
||||
EXC_RAISING(HSA_STATUS_ERROR, "Bad metric '" << name << "', var '" << var
|
||||
<< "' is not found");
|
||||
it->second->GetCounters(counters_vec);
|
||||
xml::Expr* expr_obj = NULL;
|
||||
try {
|
||||
expr_obj = new xml::Expr(expr_str, new ExprCache(&cache_));
|
||||
} catch(const xml::exception_t& exc) {
|
||||
if (do_lookup) metrics_list.push_back(node);
|
||||
else throw(exc);
|
||||
}
|
||||
if (expr_obj) {
|
||||
#if 0
|
||||
std::cout << "# " << descr << std::endl;
|
||||
std::cout << name << "=" << expr_obj->String() << "\n" << std::endl;
|
||||
#endif
|
||||
counters_vec_t counters_vec;
|
||||
for (const std::string var : expr_obj->GetVars()) {
|
||||
auto it = cache_.find(var);
|
||||
if (it == cache_.end()) {
|
||||
EXC_RAISING(HSA_STATUS_ERROR, "Bad metric '" << name << "', var '" << var << "' is not found");
|
||||
}
|
||||
it->second->GetCounters(counters_vec);
|
||||
}
|
||||
AddMetric(name, counters_vec, expr_obj);
|
||||
}
|
||||
}
|
||||
|
||||
auto cur = it++;
|
||||
metrics_list.erase(cur);
|
||||
if (--it_number == 0) {
|
||||
it_number = metrics_list.size();
|
||||
if (it_number < metrics_number) {
|
||||
metrics_number = it_number;
|
||||
} else if (it_number == metrics_number) {
|
||||
do_lookup = false;
|
||||
} else {
|
||||
EXC_RAISING(HSA_STATUS_ERROR, "Internal error");
|
||||
}
|
||||
AddMetric(name, counters_vec, expr_obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,10 @@ class Xml {
|
||||
typedef std::vector<char> token_t;
|
||||
|
||||
struct level_t;
|
||||
typedef std::vector<level_t*> nodes_t;
|
||||
typedef std::vector<level_t*> node_vect_t;
|
||||
typedef std::list<level_t*> node_list_t;
|
||||
|
||||
typedef node_vect_t nodes_t;
|
||||
typedef std::map<std::string, std::string> opts_t;
|
||||
struct level_t {
|
||||
std::string tag;
|
||||
@@ -143,6 +146,7 @@ class Xml {
|
||||
|
||||
struct print_func {
|
||||
bool fun(const std::string& global_tag, level_t* node) {
|
||||
std::cout << global_tag << ":" << std::endl;
|
||||
for (auto& opt : node->opts) {
|
||||
std::cout << global_tag << "." << opt.first << " = " << opt.second << std::endl;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
<metric name="TCC_EA1_RDREQ_32B" block=TCC event=268 descr="Number of 32-byte TCC/EA read requests"></metric>
|
||||
</gfx906>
|
||||
|
||||
<gfx908>
|
||||
<gfx908 base="gfx9">
|
||||
<metric name="SQ_INSTS_VMEM_WR" block=SQ event=28 descr="Number of VMEM write instructions issued (including FLAT). (per-simd, emulated)"></metric>
|
||||
<metric name="SQ_INSTS_VMEM_RD" block=SQ event=29 descr="Number of VMEM read instructions issued (including FLAT). (per-simd, emulated)"></metric>
|
||||
<metric name="SQ_INSTS_SALU" block=SQ event=31 descr="Number of SALU instructions issued. (per-simd, emulated)"></metric>
|
||||
|
||||
Référencer dans un nouveau ticket
Bloquer un utilisateur