library: add priming read at 'new' time <most modules>
A priming read at 'new' time in that <slabinfo> module was important so that permission problems are detected early. Plus, it also had the potential of making delta values valid when 'get' or 'select' were first called. It is for that latter reason that such a read was also incorporated in the <diskstats> module 'new' function. No other module, however, employed such priming reads. This patch just brings those potential benefits to all of our other newlib modules with the exception of that <pids> guy. That module is, of necessity, sufficiently different from those others to justify such exclusion. Not only are there precious few DELTA enums in <pids>, but the costs of a priming read would be much greater. [ otherwise, these newly added priming reads have no ] [ measurable negative impact on performance/timings. ] Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
5197fa0a71
commit
1a2b62c779
@ -749,6 +749,14 @@ PROCPS_EXPORT int procps_meminfo_new (
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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 | */
|
||||||
|
if ((rc = meminfo_read_failed(p))) {
|
||||||
|
procps_meminfo_unref(&p);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
*info = p;
|
*info = p;
|
||||||
return 0;
|
return 0;
|
||||||
} // end: procps_meminfo_new
|
} // end: procps_meminfo_new
|
||||||
|
@ -828,6 +828,7 @@ PROCPS_EXPORT int procps_stat_new (
|
|||||||
struct stat_info **info)
|
struct stat_info **info)
|
||||||
{
|
{
|
||||||
struct stat_info *p;
|
struct stat_info *p;
|
||||||
|
int rc;
|
||||||
|
|
||||||
if (info == NULL || *info != NULL)
|
if (info == NULL || *info != NULL)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -869,6 +870,14 @@ PROCPS_EXPORT int procps_stat_new (
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* 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 | */
|
||||||
|
if ((rc = stat_read_failed(p))) {
|
||||||
|
procps_stat_unref(&p);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
*info = p;
|
*info = p;
|
||||||
return 0;
|
return 0;
|
||||||
} // end :procps_stat_new
|
} // end :procps_stat_new
|
||||||
|
@ -1133,6 +1133,14 @@ PROCPS_EXPORT int procps_vmstat_new (
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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 | */
|
||||||
|
if ((rc = vmstat_read_failed(p))) {
|
||||||
|
procps_vmstat_unref(&p);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
*info = p;
|
*info = p;
|
||||||
return 0;
|
return 0;
|
||||||
} // end: procps_vmstat_new
|
} // end: procps_vmstat_new
|
||||||
|
Loading…
Reference in New Issue
Block a user