library: eliminate distorted history 1st time switches
Upon reflection, at the point where the 'priming read' was introduced, any possibility of history distortions was also eliminated. This was true because all of the 'old' (zeroed) data will have been replaced with 'new' data whenever a user finally calls get, select & reap. Thus, any DELTA values will automatically reflect that interval between 'new' and subsequent retrieval calls. [ diskstats didn't actually employ a 1st time switch ] [ like the others so we have changed a comment only. ] [ but that module will retain something similar used ] [ inside node_update whenever a new node is created. ] Reference(s): . priming read added to slabinfo commit5d5a52a380
. priming read added to diskstats commitecd64f4445
. priming read added to meminfo, stat, vmstat commit1a2b62c779
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
@ -109,7 +109,6 @@ struct stacks_extent {
|
||||
struct meminfo_info {
|
||||
int refcount;
|
||||
int meminfo_fd;
|
||||
int meminfo_was_read;
|
||||
int dirty_stacks;
|
||||
struct mem_hist hist;
|
||||
int numitems;
|
||||
@ -644,11 +643,6 @@ static int meminfo_read_failed (
|
||||
if (mHr(SwapFree) < mHr(SwapTotal))
|
||||
mHr(derived_swap_used) = mHr(SwapTotal) - mHr(SwapFree);
|
||||
|
||||
// let's not distort the deltas the first time thru ...
|
||||
if (!info->meminfo_was_read) {
|
||||
memcpy(&info->hist.old, &info->hist.new, sizeof(struct meminfo_data));
|
||||
info->meminfo_was_read = 1;
|
||||
}
|
||||
return 0;
|
||||
#undef mHr
|
||||
} // end: meminfo_read_failed
|
||||
@ -751,7 +745,8 @@ PROCPS_EXPORT int procps_meminfo_new (
|
||||
|
||||
/* do a priming read here for the following potential benefits: |
|
||||
1) ensure there will be no problems with subsequent access |
|
||||
2) make delta results potentially useful, even if 1st time | */
|
||||
2) make delta results potentially useful, even if 1st time |
|
||||
3) elimnate need for history distortions 1st time 'switch' | */
|
||||
if ((rc = meminfo_read_failed(p))) {
|
||||
procps_meminfo_unref(&p);
|
||||
return rc;
|
||||
|
Reference in New Issue
Block a user