alibaba / tsar

Taobao System Activity Reporter
Apache License 2.0
2.48k stars 733 forks source link

--check will take wrong when limit with -s #44

Closed mingzym closed 6 years ago

mingzym commented 10 years ago
[root@BJDXT_ATS_75 tsar]# tsar --check --tcpx -s cnest
BJDXT_ATS_75    tsar    tcpx:est=0.0 tcpx:cnest=114.0

[root@BJDXT_ATS_75 tsar]# tsar --check --ts_cache -s ramhit
BJDXT_ATS_75    tsar    ts_cache:hit=14.5 ts_cache:ramhit=13.3

due to

void
set_special_field(const char *s)
{
    int    i = 0, j = 0;
    struct module *mod = NULL;

    for (i = 0; i < statis.total_mod_num; i++)
    {
        mod = &mods[i];
        struct mod_info *info = mod->info;
        for (j=0; j < mod->n_col; j++) {
            char *p = info[j].hdr;
            while (*p  == ' ') {
                p++;
            }
            if (strstr(s, p)) {
                info[j].summary_bit = SPEC_BIT;
                mod->spec = 1;
            }
        }
    }
}

strstr est to cnest is always a hit. that is not what we want.

kongjian commented 10 years ago

I have noticed it before, but didn't fix it, i think it is useful for who don't know exactly the item name, Do you have any good idea such as this: tsar --check --mod -s item1,item2 that who want to see more than one item at one time?if use this patch we just support one item at a time. anyway it is a bug and should be fix as you have supplied.