use getpagesize() instead of PAGE_SHIFT
This commit is contained in:
parent
5a6526f0aa
commit
67a86f31d7
@ -29,9 +29,7 @@
|
|||||||
#include "sigar_util.h"
|
#include "sigar_util.h"
|
||||||
#include "sigar_os.h"
|
#include "sigar_os.h"
|
||||||
|
|
||||||
#include <asm/page.h> /* for PAGE_SHIFT */
|
#define pageshift(x) ((x) << sigar->pagesize)
|
||||||
|
|
||||||
#define pageshift(x) ((x) << PAGE_SHIFT)
|
|
||||||
|
|
||||||
#define PROC_MEMINFO PROC_FS_ROOT "meminfo"
|
#define PROC_MEMINFO PROC_FS_ROOT "meminfo"
|
||||||
#define PROC_MTRR PROC_FS_ROOT "mtrr"
|
#define PROC_MTRR PROC_FS_ROOT "mtrr"
|
||||||
@ -125,6 +123,7 @@ sigar_pid_t sigar_pid_get(sigar_t *sigar)
|
|||||||
int sigar_os_open(sigar_t **sigar)
|
int sigar_os_open(sigar_t **sigar)
|
||||||
{
|
{
|
||||||
char buffer[BUFSIZ], *ptr;
|
char buffer[BUFSIZ], *ptr;
|
||||||
|
int i;
|
||||||
int status = sigar_file2str(PROC_STAT, buffer, sizeof(buffer));
|
int status = sigar_file2str(PROC_STAT, buffer, sizeof(buffer));
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
@ -134,6 +133,12 @@ int sigar_os_open(sigar_t **sigar)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(*sigar)->pagesize = 0;
|
||||||
|
i = sysconf(_SC_PAGESIZE);
|
||||||
|
while ((i >>= 1) > 0) {
|
||||||
|
(*sigar)->pagesize++;
|
||||||
|
}
|
||||||
|
|
||||||
ptr = strstr(buffer, "\nbtime");
|
ptr = strstr(buffer, "\nbtime");
|
||||||
ptr = sigar_skip_token(ptr);
|
ptr = sigar_skip_token(ptr);
|
||||||
(*sigar)->boot_time = sigar_strtoul(ptr);
|
(*sigar)->boot_time = sigar_strtoul(ptr);
|
||||||
|
@ -60,6 +60,7 @@ typedef enum {
|
|||||||
|
|
||||||
struct sigar_t {
|
struct sigar_t {
|
||||||
SIGAR_T_BASE;
|
SIGAR_T_BASE;
|
||||||
|
int pagesize;
|
||||||
int ram;
|
int ram;
|
||||||
int proc_signal_offset;
|
int proc_signal_offset;
|
||||||
linux_proc_stat_t last_proc_stat;
|
linux_proc_stat_t last_proc_stat;
|
||||||
|
Loading…
Reference in New Issue
Block a user