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

Method GetGraphPerfAttr

executor/lib/graph_task.cpp:498–562  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

496}
497
498bool GraphTask::GetGraphPerfAttr(const char* name, void* val, int size)
499{
500 GraphPerfMsg* perf_msg = ( GraphPerfMsg* )val;
501
502 struct perf_info** info = perf_msg->buf;
503 int info_idx = 0;
504 bool loop_done = false;
505 bool fetch_error = false;
506 int entry_number = perf_msg->buf_size;
507
508 for(unsigned int i = 0; i < sub_task_list_.size(); i++)
509 {
510 auto sub_task = sub_task_list_[i];
511 int buf_num = 100;
512
513 GraphPerfMsg tmp_msg;
514 tmp_msg.action = perf_msg->action;
515 tmp_msg.buf = nullptr;
516
517 do
518 {
519 if(tmp_msg.buf)
520 {
521 free(tmp_msg.buf);
522 buf_num += 100;
523 }
524
525 tmp_msg.buf = ( struct perf_info** )malloc(buf_num * sizeof(void*));
526 tmp_msg.buf_size = buf_num;
527 tmp_msg.ret_number = -1;
528
529 if(!sub_task->GetAttr(name, &tmp_msg, sizeof(tmp_msg)))
530 {
531 tmp_msg.ret_number = -1;
532 fetch_error = true;
533 loop_done = true;
534 break;
535 }
536 } while(tmp_msg.ret_number == buf_num);
537
538 for(int i = 0; i < tmp_msg.ret_number; i++)
539 {
540 info[info_idx++] = tmp_msg.buf[i];
541
542 if(info_idx == entry_number)
543 {
544 loop_done = true;
545 break;
546 }
547 }
548
549 free(tmp_msg.buf);
550
551 if(loop_done)
552 break;
553 }
554
555 if(fetch_error)

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45
GetAttrMethod · 0.45

Tested by

no test coverage detected