• B
    linuxNodeGetCPUStats: Correctly handle cpu prefix · 94f82053
    Bing Bu Cao 提交于
    To retrieve node cpu statistics on Linux system, the
    linuxNodeGetCPUstats function simply uses STRPREFIX() to match the cpuid
    with the one read from /proc/stat. However, as the file is read line by
    line it may happen, that some CPUs share the same prefix. So if user
    requested stats for the first CPU, which is offline, then there's no
    cpu1 in the stats file so the one that we match is cpu10. Which is
    obviously wrong. Fortunately, the IDs are terminated by a space, so we
    can utilize that.
    Signed-off-by: NBing Bu Cao <mars@linux.vnet.ibm.com>
    94f82053
nodeinfo.c 48.8 KB