fold sigar_proc_count into sigar_proc_stat_get

This commit is contained in:
Doug MacEachern 2007-04-14 21:28:17 +00:00
parent 405e95e6bb
commit 578b7607db
3 changed files with 11 additions and 25 deletions

View File

@ -93,10 +93,6 @@ int sigar_proc_list_procfs_get(sigar_t *sigar,
int sigar_proc_fd_count(sigar_t *sigar, sigar_pid_t pid,
sigar_uint64_t *total);
/* generic util functions for all platforms */
int sigar_proc_count(sigar_t *sigar, sigar_uint64_t *total);
/* linux + freebsd */
int sigar_procfs_args_get(sigar_t *sigar, sigar_pid_t pid,
sigar_proc_args_t *procargs);

View File

@ -137,11 +137,20 @@ SIGAR_DECLARE(int) sigar_proc_cpu_get(sigar_t *sigar, sigar_pid_t pid,
SIGAR_DECLARE(int) sigar_proc_stat_get(sigar_t *sigar,
sigar_proc_stat_t *procstat)
{
int status = sigar_proc_count(sigar, &procstat->total);
int status;
sigar_proc_list_t proclist;
if ((status = sigar_proc_list_get(sigar, &proclist)) != SIGAR_OK) {
return status;
}
procstat->total = proclist.number;
sigar_proc_list_destroy(sigar, &proclist);
return SIGAR_OK;
}
static char *sigar_error_string(int err)
{
switch (err) {

View File

@ -293,25 +293,6 @@ int sigar_procfs_args_get(sigar_t *sigar, sigar_pid_t pid,
#endif /* WIN32 */
/* os impls should use an optimized version of this */
int sigar_proc_count(sigar_t *sigar, sigar_uint64_t *total)
{
int status;
sigar_proc_list_t proclist;
*total = 0;
if ((status = sigar_proc_list_get(sigar, &proclist)) != SIGAR_OK) {
return status;
}
*total = proclist.number;
sigar_proc_list_destroy(sigar, &proclist);
return SIGAR_OK;
}
int sigar_mem_calc_ram(sigar_t *sigar, sigar_mem_t *mem)
{
sigar_uint64_t lram = (mem->total / (1024 * 1024));