0. 상황 리뷰


  • 우선 어제랑 오늘이랑 해서, 내게 전송된 이메일은 모두 처리한 것 같다. 사실 오늘 지각을 하기도 했고, 이것저것 설정을 하다 보니 오전시간은 모두 지나버렸다. 따라서 오픈 소스 개발은 많이 진행하지 못할 것 같다.

  • 오히려 uftrace 관련된 작업을 하는 것이 나을 수도 있을 것이라는 생각이 들었다.

1. 목표 설정


  • 오전 시간에는 uftrace 기능 추가 관련된 부분을 살펴보기로 한다.

  • 오후 시간에는 LMS 를 확인할 예정인데, 푸터바와, 시스템 네비게이션에 새로운 메뉴를 추가할 것이다.

2. 전략 / 전술 수립


  • command_tui() 라는 함수에서, build_tui_node() 함수를 반복적으로 호출하여 그래프를 만드는 것을 확인할 수 있었다.

  • 그래프를 만드는 과정에서 이름과 주소를 만드는 것을 확인하였고, 시간 정보와 같은 것은 tui_main_loop()->tui_graph_init() 함수에서 만드는 것을 확인할 수 있었다.

while (read_rstack(&handle, &task) == 0 && !uftrace_done) {
    struct uftrace_record *rec = task->rstack;

    if (!fstack_check_opts(task, opts))
        continue;

    if (!fstack_check_filter(task))
        continue;

    ret = build_tui_node(task, rec, opts);
    if (ret)
        break;

    fstack_check_filter_done(task);
}
  • 위의 코드는 command_tui() 함수의 한 부분이며 아래 코드는 tui_graph_init()에서 각 그래프의 평균값을 구한다고 생각하는 곳이다.
list_for_each_entry(graph, &tui_graph_list, list) {
    /* top (root) is an artificial node, fill the info */
    top = &graph->ug.root;
    top->name = basename(graph->ug.sess->exename);
    top->nr_calls = 1;

    list_for_each_entry(node, &graph->ug.root.head, list) {
        top->total_time.sum += node->total_time.sum;
        top->self_time.sum += node->self_time.sum;
    }
    top->total_time.avg = top->total_time.sum / top->nr_calls;

    tui_window_init(&graph->win, &graph_ops);

    graph->mask_size = sizeof(*graph->top_mask) * opts->max_stack;

    graph->top_mask = xzalloc(graph->mask_size);
    graph->disp_mask = xmalloc(graph->mask_size);
}

graph = list_first_entry(&tui_graph_list, typeof(*graph), list);

partial_graph.mask_size = graph->mask_size;
partial_graph.top_mask = xzalloc(graph->mask_size);
partial_graph.disp_mask = xmalloc(graph->mask_size);
  • 이제 여기서, 평균값과 min, max만 구하면 될 것 이다.

3. 가성비 측정


4. 실행 여부 판단


5. 자원 할당


>> Home