MCPcopy Create free account
hub / github.com/OAID/Tengine / GetGraphPerfStat

Method GetGraphPerfStat

driver/cpu/cpu_runner.cpp:1137–1163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1135}
1136
1137int CPURunner::GetGraphPerfStat(Subgraph* graph, struct perf_info** buf, int buf_size)
1138{
1139 graph->Lock();
1140
1141 if(!graph->ExistAttr(ATTR_GRAPH_PERF_BUFFER))
1142 {
1143 graph->Unlock();
1144 set_tengine_errno(EINVAL);
1145 return -1;
1146 }
1147
1148 GraphPerfStatBuf* perf_buf = any_cast<GraphPerfStatBuf>(&graph->GetAttr(ATTR_GRAPH_PERF_BUFFER));
1149
1150 int cpy_number = perf_buf->real_number;
1151
1152 if(cpy_number > buf_size)
1153 cpy_number = buf_size;
1154
1155 for(int i = 0; i < cpy_number; i++)
1156 {
1157 buf[i] = &perf_buf->records.at(i);
1158 }
1159
1160 graph->Unlock();
1161
1162 return cpy_number;
1163}
1164
1165} // namespace TEngine

Callers 1

OnGetGraphPerfAttrMethod · 0.45

Calls 5

set_tengine_errnoFunction · 0.85
LockMethod · 0.45
ExistAttrMethod · 0.45
UnlockMethod · 0.45
GetAttrMethod · 0.45

Tested by

no test coverage detected