spice server tools

来源:互联网 发布:淘宝网购物手机 编辑:程序博客网 时间:2024/06/05 07:56

export CFLAGS= -DRED_STATISTICS

reds_stat.c

static void print_stat_tree(int32_t node_index, int depth)
{
    SpiceStatNode *node = &reds_nodes[node_index];


    if ((node->flags & SPICE_STAT_NODE_MASK_SHOW) == SPICE_STAT_NODE_MASK_SHOW) {
        printf("%*s%s", depth * TAB_LEN, "", node->name);
        if (node->flags & SPICE_STAT_NODE_FLAG_VALUE) {
            printf(":%*s%"PRIu64" (%"PRIu64")\n", (int) ((VALUE_TABS - depth) * TAB_LEN - strlen(node->name) - 1), "", 
                   node->value, node->value - values[node_index]);
            values[node_index] = node->value;
        } else {
            printf("\n");
            if (node->first_child_index != INVALID_STAT_REF) {
                print_stat_tree(node->first_child_index, depth + 1); 
            }
        }
    }   
    if (node->next_sibling_index != INVALID_STAT_REF) {
        print_stat_tree(node->next_sibling_index, depth);
    }   
}


red-worker.c

red_worker_new
#ifdef RED_STATISTICS
    char worker_str[20];
    sprintf(worker_str, "display[%d]", worker->qxl->id);
    worker->stat = stat_add_node(reds, INVALID_STAT_REF, worker_str, TRUE);
    worker->wakeup_counter = stat_add_counter(reds, worker->stat, "wakeups", TRUE);
    worker->command_counter = stat_add_counter(reds, worker->stat, "commands", TRUE);
#endif

stat_add_node
StatNodeRef stat_add_node(RedsState *reds, StatNodeRef parent, const char *name, int visible)
{
    return stat_file_add_node(reds->stat_file, parent, name, visible);
}

stat_file_add_node



0 0