tsar源码分析

从modules/mod_cpu.c入手

./devel/tsar.h

module 结构体:

struct module {

    char    name[LEN_32];
    char    opt_line[LEN_32];
    char    record[LEN_1M];
    char    usage[LEN_256];
    char    parameter[LEN_256];
    char    print_item[LEN_256];

    struct  mod_info *info;
    void   *lib;
    int     enable;
    int     spec;
    int     p_item;

    /* private data used by framework*/
    int     n_item;
    int     n_col;
    long    n_record;    

    int     pre_flag:4;
    int     st_flag:4;

    U_64   *pre_array;
    U_64   *cur_array;
    double *st_array;
    double *max_array;
    double *mean_array;
    double *min_array;

    /* callback function of module */
    void (*data_collect) (struct module *, char *);
    void (*set_st_record) (struct module *, double *, U_64 *, U_64 *, int);

    /* mod manage */
    void (*mod_register) (struct module *);
};
posted @ 2017-05-08 19:03  苏小北1024  阅读(255)  评论(0编辑  收藏  举报