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

Method OnSetNodeDumpAttr

driver/cpu/cpu_driver.cpp:472–519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

470}
471
472bool CPUDriver::OnSetNodeDumpAttr(DevContext* context, Subgraph* graph, const char* name, const void* buf, int size)
473{
474 if(size != sizeof(NodeDumpMsg))
475 {
476 set_tengine_errno(EINVAL);
477 return false;
478 }
479
480 const NodeDumpMsg* msg = ( const NodeDumpMsg* )buf;
481 const char* node_name = msg->node_name;
482
483 Node* node = graph->FindNode(node_name);
484
485 if(node == nullptr)
486 {
487 set_tengine_errno(EINVAL);
488 return false;
489 }
490
491 if(!node->ExistAttr(ATTR_NODE_OPS))
492 {
493 set_tengine_errno(ENOTSUP);
494 return false;
495 }
496
497 NodeOps* node_ops = any_cast<NodeOps*>(node->GetAttr(ATTR_NODE_OPS));
498
499 int action = msg->action;
500
501 switch(action)
502 {
503 case NODE_DUMP_ACTION_DISABLE:
504 return node_ops->DisableDump(node);
505 break;
506 case NODE_DUMP_ACTION_ENABLE:
507 return node_ops->EnableDump(node);
508 break;
509 case NODE_DUMP_ACTION_START:
510 return node_ops->StartDump(node);
511 break;
512 case NODE_DUMP_ACTION_STOP:
513 return node_ops->StopDump(node);
514 break;
515 default:
516 set_tengine_errno(EINVAL);
517 return false;
518 }
519}
520
521bool CPUDriver::OnSetGraphPerfAttr(DevContext* context, Subgraph* graph, const char* name, const void* buf, int size)
522{

Callers

nothing calls this directly

Calls 8

set_tengine_errnoFunction · 0.85
DisableDumpMethod · 0.80
EnableDumpMethod · 0.80
StartDumpMethod · 0.80
StopDumpMethod · 0.80
FindNodeMethod · 0.45
ExistAttrMethod · 0.45
GetAttrMethod · 0.45

Tested by

no test coverage detected