[ $(( processors )) -lt 1 ] && processors=1
# you can set CFLAGS before running installer
-CFLAGS="${CFLAGS--O3}"
+CFLAGS="${CFLAGS--O2}"
+[ "z${CFLAGS}" = "z-O3" ] && CFLAGS="-O2"
# keep a log of this command
printf "\n# " >>netdata-installer.log
Use this option to allow it continue
without checking pkg-config.
-Netdata will by default be compiled with gcc optimization -O3
+Netdata will by default be compiled with gcc optimization -O2
If you need to pass different CFLAGS, use something like this:
CFLAGS="<gcc options>" ${ME} <installer options>
p->stat_collected_usec = now_realtime_usec();
file_counter++;
- // p->pid = atol(procfile_lineword(ff, 0, 0+i));
+ // p->pid = str2ul(procfile_lineword(ff, 0, 0+i));
strncpyz(p->comm, procfile_lineword(ff, 0, 1), MAX_COMPARE_NAME);
// p->state = *(procfile_lineword(ff, 0, 2));
- p->ppid = (int32_t) atol(procfile_lineword(ff, 0, 3));
- // p->pgrp = atol(procfile_lineword(ff, 0, 4));
- // p->session = atol(procfile_lineword(ff, 0, 5));
- // p->tty_nr = atol(procfile_lineword(ff, 0, 6));
- // p->tpgid = atol(procfile_lineword(ff, 0, 7));
- // p->flags = strtoull(procfile_lineword(ff, 0, 8), NULL, 10);
+ p->ppid = (int32_t)str2ul(procfile_lineword(ff, 0, 3));
+ // p->pgrp = str2ul(procfile_lineword(ff, 0, 4));
+ // p->session = str2ul(procfile_lineword(ff, 0, 5));
+ // p->tty_nr = str2ul(procfile_lineword(ff, 0, 6));
+ // p->tpgid = str2ul(procfile_lineword(ff, 0, 7));
+ // p->flags = str2ull(procfile_lineword(ff, 0, 8));
unsigned long long last;
last = p->minflt_raw;
- p->minflt_raw = strtoull(procfile_lineword(ff, 0, 9), NULL, 10);
+ p->minflt_raw = str2ull(procfile_lineword(ff, 0, 9));
p->minflt = (p->minflt_raw - last) * (USEC_PER_SEC * RATES_DETAIL) / (p->stat_collected_usec - p->last_stat_collected_usec);
last = p->cminflt_raw;
- p->cminflt_raw = strtoull(procfile_lineword(ff, 0, 10), NULL, 10);
+ p->cminflt_raw = str2ull(procfile_lineword(ff, 0, 10));
p->cminflt = (p->cminflt_raw - last) * (USEC_PER_SEC * RATES_DETAIL) / (p->stat_collected_usec - p->last_stat_collected_usec);
last = p->majflt_raw;
- p->majflt_raw = strtoull(procfile_lineword(ff, 0, 11), NULL, 10);
+ p->majflt_raw = str2ull(procfile_lineword(ff, 0, 11));
p->majflt = (p->majflt_raw - last) * (USEC_PER_SEC * RATES_DETAIL) / (p->stat_collected_usec - p->last_stat_collected_usec);
last = p->cmajflt_raw;
- p->cmajflt_raw = strtoull(procfile_lineword(ff, 0, 12), NULL, 10);
+ p->cmajflt_raw = str2ull(procfile_lineword(ff, 0, 12));
p->cmajflt = (p->cmajflt_raw - last) * (USEC_PER_SEC * RATES_DETAIL) / (p->stat_collected_usec - p->last_stat_collected_usec);
last = p->utime_raw;
- p->utime_raw = strtoull(procfile_lineword(ff, 0, 13), NULL, 10);
+ p->utime_raw = str2ull(procfile_lineword(ff, 0, 13));
p->utime = (p->utime_raw - last) * (USEC_PER_SEC * RATES_DETAIL) / (p->stat_collected_usec - p->last_stat_collected_usec);
last = p->stime_raw;
- p->stime_raw = strtoull(procfile_lineword(ff, 0, 14), NULL, 10);
+ p->stime_raw = str2ull(procfile_lineword(ff, 0, 14));
p->stime = (p->stime_raw - last) * (USEC_PER_SEC * RATES_DETAIL) / (p->stat_collected_usec - p->last_stat_collected_usec);
last = p->cutime_raw;
- p->cutime_raw = strtoull(procfile_lineword(ff, 0, 15), NULL, 10);
+ p->cutime_raw = str2ull(procfile_lineword(ff, 0, 15));
p->cutime = (p->cutime_raw - last) * (USEC_PER_SEC * RATES_DETAIL) / (p->stat_collected_usec - p->last_stat_collected_usec);
last = p->cstime_raw;
- p->cstime_raw = strtoull(procfile_lineword(ff, 0, 16), NULL, 10);
+ p->cstime_raw = str2ull(procfile_lineword(ff, 0, 16));
p->cstime = (p->cstime_raw - last) * (USEC_PER_SEC * RATES_DETAIL) / (p->stat_collected_usec - p->last_stat_collected_usec);
- // p->priority = strtoull(procfile_lineword(ff, 0, 17), NULL, 10);
- // p->nice = strtoull(procfile_lineword(ff, 0, 18), NULL, 10);
- p->num_threads = (int32_t) atol(procfile_lineword(ff, 0, 19));
- // p->itrealvalue = strtoull(procfile_lineword(ff, 0, 20), NULL, 10);
- // p->starttime = strtoull(procfile_lineword(ff, 0, 21), NULL, 10);
- // p->vsize = strtoull(procfile_lineword(ff, 0, 22), NULL, 10);
- // p->rss = strtoull(procfile_lineword(ff, 0, 23), NULL, 10);
- // p->rsslim = strtoull(procfile_lineword(ff, 0, 24), NULL, 10);
- // p->starcode = strtoull(procfile_lineword(ff, 0, 25), NULL, 10);
- // p->endcode = strtoull(procfile_lineword(ff, 0, 26), NULL, 10);
- // p->startstack = strtoull(procfile_lineword(ff, 0, 27), NULL, 10);
- // p->kstkesp = strtoull(procfile_lineword(ff, 0, 28), NULL, 10);
- // p->kstkeip = strtoull(procfile_lineword(ff, 0, 29), NULL, 10);
- // p->signal = strtoull(procfile_lineword(ff, 0, 30), NULL, 10);
- // p->blocked = strtoull(procfile_lineword(ff, 0, 31), NULL, 10);
- // p->sigignore = strtoull(procfile_lineword(ff, 0, 32), NULL, 10);
- // p->sigcatch = strtoull(procfile_lineword(ff, 0, 33), NULL, 10);
- // p->wchan = strtoull(procfile_lineword(ff, 0, 34), NULL, 10);
- // p->nswap = strtoull(procfile_lineword(ff, 0, 35), NULL, 10);
- // p->cnswap = strtoull(procfile_lineword(ff, 0, 36), NULL, 10);
- // p->exit_signal = atol(procfile_lineword(ff, 0, 37));
- // p->processor = atol(procfile_lineword(ff, 0, 38));
- // p->rt_priority = strtoul(procfile_lineword(ff, 0, 39), NULL, 10);
- // p->policy = strtoul(procfile_lineword(ff, 0, 40), NULL, 10);
- // p->delayacct_blkio_ticks = strtoull(procfile_lineword(ff, 0, 41), NULL, 10);
+ // p->priority = str2ull(procfile_lineword(ff, 0, 17));
+ // p->nice = str2ull(procfile_lineword(ff, 0, 18));
+ p->num_threads = (int32_t)str2ul(procfile_lineword(ff, 0, 19));
+ // p->itrealvalue = str2ull(procfile_lineword(ff, 0, 20));
+ // p->starttime = str2ull(procfile_lineword(ff, 0, 21));
+ // p->vsize = str2ull(procfile_lineword(ff, 0, 22));
+ // p->rss = str2ull(procfile_lineword(ff, 0, 23));
+ // p->rsslim = str2ull(procfile_lineword(ff, 0, 24));
+ // p->starcode = str2ull(procfile_lineword(ff, 0, 25));
+ // p->endcode = str2ull(procfile_lineword(ff, 0, 26));
+ // p->startstack = str2ull(procfile_lineword(ff, 0, 27));
+ // p->kstkesp = str2ull(procfile_lineword(ff, 0, 28));
+ // p->kstkeip = str2ull(procfile_lineword(ff, 0, 29));
+ // p->signal = str2ull(procfile_lineword(ff, 0, 30));
+ // p->blocked = str2ull(procfile_lineword(ff, 0, 31));
+ // p->sigignore = str2ull(procfile_lineword(ff, 0, 32));
+ // p->sigcatch = str2ull(procfile_lineword(ff, 0, 33));
+ // p->wchan = str2ull(procfile_lineword(ff, 0, 34));
+ // p->nswap = str2ull(procfile_lineword(ff, 0, 35));
+ // p->cnswap = str2ull(procfile_lineword(ff, 0, 36));
+ // p->exit_signal = str2ul(procfile_lineword(ff, 0, 37));
+ // p->processor = str2ul(procfile_lineword(ff, 0, 38));
+ // p->rt_priority = str2ul(procfile_lineword(ff, 0, 39));
+ // p->policy = str2ul(procfile_lineword(ff, 0, 40));
+ // p->delayacct_blkio_ticks = str2ull(procfile_lineword(ff, 0, 41));
if(enable_guest_charts) {
last = p->gtime_raw;
- p->gtime_raw = strtoull(procfile_lineword(ff, 0, 42), NULL, 10);
+ p->gtime_raw = str2ull(procfile_lineword(ff, 0, 42));
p->gtime = (p->gtime_raw - last) * (USEC_PER_SEC * RATES_DETAIL) / (p->stat_collected_usec - p->last_stat_collected_usec);
last = p->cgtime_raw;
- p->cgtime_raw = strtoull(procfile_lineword(ff, 0, 43), NULL, 10);
+ p->cgtime_raw = str2ull(procfile_lineword(ff, 0, 43));
p->cgtime = (p->cgtime_raw - last) * (USEC_PER_SEC * RATES_DETAIL) / (p->stat_collected_usec - p->last_stat_collected_usec);
if (show_guest_time || p->gtime || p->cgtime) {
file_counter++;
- p->statm_size = strtoull(procfile_lineword(ff, 0, 0), NULL, 10);
- p->statm_resident = strtoull(procfile_lineword(ff, 0, 1), NULL, 10);
- p->statm_share = strtoull(procfile_lineword(ff, 0, 2), NULL, 10);
- // p->statm_text = strtoull(procfile_lineword(ff, 0, 3), NULL, 10);
- // p->statm_lib = strtoull(procfile_lineword(ff, 0, 4), NULL, 10);
- // p->statm_data = strtoull(procfile_lineword(ff, 0, 5), NULL, 10);
- // p->statm_dirty = strtoull(procfile_lineword(ff, 0, 6), NULL, 10);
+ p->statm_size = str2ull(procfile_lineword(ff, 0, 0));
+ p->statm_resident = str2ull(procfile_lineword(ff, 0, 1));
+ p->statm_share = str2ull(procfile_lineword(ff, 0, 2));
+ // p->statm_text = str2ull(procfile_lineword(ff, 0, 3));
+ // p->statm_lib = str2ull(procfile_lineword(ff, 0, 4));
+ // p->statm_data = str2ull(procfile_lineword(ff, 0, 5));
+ // p->statm_dirty = str2ull(procfile_lineword(ff, 0, 6));
return 1;
unsigned long long last;
last = p->io_logical_bytes_read_raw;
- p->io_logical_bytes_read_raw = strtoull(procfile_lineword(ff, 0, 1), NULL, 10);
+ p->io_logical_bytes_read_raw = str2ull(procfile_lineword(ff, 0, 1));
p->io_logical_bytes_read = (p->io_logical_bytes_read_raw - last) * (USEC_PER_SEC * RATES_DETAIL) / (p->io_collected_usec - p->last_io_collected_usec);
last = p->io_logical_bytes_written_raw;
- p->io_logical_bytes_written_raw = strtoull(procfile_lineword(ff, 1, 1), NULL, 10);
+ p->io_logical_bytes_written_raw = str2ull(procfile_lineword(ff, 1, 1));
p->io_logical_bytes_written = (p->io_logical_bytes_written_raw - last) * (USEC_PER_SEC * RATES_DETAIL) / (p->io_collected_usec - p->last_io_collected_usec);
// last = p->io_read_calls_raw;
- // p->io_read_calls_raw = strtoull(procfile_lineword(ff, 2, 1), NULL, 10);
+ // p->io_read_calls_raw = str2ull(procfile_lineword(ff, 2, 1));
// p->io_read_calls = (p->io_read_calls_raw - last) * (USEC_PER_SEC * RATES_DETAIL) / (p->io_collected_usec - p->last_io_collected_usec);
// last = p->io_write_calls_raw;
- // p->io_write_calls_raw = strtoull(procfile_lineword(ff, 3, 1), NULL, 10);
+ // p->io_write_calls_raw = str2ull(procfile_lineword(ff, 3, 1));
// p->io_write_calls = (p->io_write_calls_raw - last) * (USEC_PER_SEC * RATES_DETAIL) / (p->io_collected_usec - p->last_io_collected_usec);
last = p->io_storage_bytes_read_raw;
- p->io_storage_bytes_read_raw = strtoull(procfile_lineword(ff, 4, 1), NULL, 10);
+ p->io_storage_bytes_read_raw = str2ull(procfile_lineword(ff, 4, 1));
p->io_storage_bytes_read = (p->io_storage_bytes_read_raw - last) * (USEC_PER_SEC * RATES_DETAIL) / (p->io_collected_usec - p->last_io_collected_usec);
last = p->io_storage_bytes_written_raw;
- p->io_storage_bytes_written_raw = strtoull(procfile_lineword(ff, 5, 1), NULL, 10);
+ p->io_storage_bytes_written_raw = str2ull(procfile_lineword(ff, 5, 1));
p->io_storage_bytes_written = (p->io_storage_bytes_written_raw - last) * (USEC_PER_SEC * RATES_DETAIL) / (p->io_collected_usec - p->last_io_collected_usec);
// last = p->io_cancelled_write_bytes_raw;
- // p->io_cancelled_write_bytes_raw = strtoull(procfile_lineword(ff, 6, 1), NULL, 10);
+ // p->io_cancelled_write_bytes_raw = str2ull(procfile_lineword(ff, 6, 1));
// p->io_cancelled_write_bytes = (p->io_cancelled_write_bytes_raw - last) * (USEC_PER_SEC * RATES_DETAIL) / (p->io_collected_usec - p->last_io_collected_usec);
if(unlikely(global_iterations_counter == 1)) {
unsigned long long last;
last = utime_raw;
- utime_raw = strtoull(procfile_lineword(ff, 0, 1), NULL, 10);
+ utime_raw = str2ull(procfile_lineword(ff, 0, 1));
global_utime = (utime_raw - last) * (USEC_PER_SEC * RATES_DETAIL) / (collected_usec - last_collected_usec);
// nice time, on user time
last = ntime_raw;
- ntime_raw = strtoull(procfile_lineword(ff, 0, 2), NULL, 10);
+ ntime_raw = str2ull(procfile_lineword(ff, 0, 2));
global_utime += (ntime_raw - last) * (USEC_PER_SEC * RATES_DETAIL) / (collected_usec - last_collected_usec);
last = stime_raw;
- stime_raw = strtoull(procfile_lineword(ff, 0, 3), NULL, 10);
+ stime_raw = str2ull(procfile_lineword(ff, 0, 3));
global_stime = (stime_raw - last) * (USEC_PER_SEC * RATES_DETAIL) / (collected_usec - last_collected_usec);
last = gtime_raw;
- gtime_raw = strtoull(procfile_lineword(ff, 0, 10), NULL, 10);
+ gtime_raw = str2ull(procfile_lineword(ff, 0, 10));
global_gtime = (gtime_raw - last) * (USEC_PER_SEC * RATES_DETAIL) / (collected_usec - last_collected_usec);
if(enable_guest_charts) {
// guest nice time, on guest time
last = gntime_raw;
- gntime_raw = strtoull(procfile_lineword(ff, 0, 11), NULL, 10);
+ gntime_raw = str2ull(procfile_lineword(ff, 0, 11));
global_gtime += (gntime_raw - last) * (USEC_PER_SEC * RATES_DETAIL) / (collected_usec - last_collected_usec);
// remove guest time from user time
continue;
// check if the fds array is small
- int fdid = atoi(de->d_name);
+ int fdid = (int)str2l(de->d_name);
if(fdid < 0) continue;
if(fdid >= p->fds_size) {
// it is small, extend it
for(i = 1; i < argc; i++) {
if(!freq) {
- int n = atoi(argv[i]);
+ int n = (int)str2l(argv[i]);
if(n > 0) {
freq = n;
continue;
hz = (unsigned int) ticks;
}
+
+/*
+// poor man cycle counting
+static unsigned long tsc;
+void begin_tsc(void) {
+ unsigned long a, d;
+ asm volatile ("cpuid\nrdtsc" : "=a" (a), "=d" (d) : "0" (0) : "ebx", "ecx");
+ tsc = ((unsigned long)d << 32) | (unsigned long)a;
+}
+unsigned long end_tsc(void) {
+ unsigned long a, d;
+ asm volatile ("rdtscp" : "=a" (a), "=d" (d) : : "ecx");
+ return (((unsigned long)d << 32) | (unsigned long)a) - tsc;
+}
+*/
#include "common.h"
-#ifdef HAVE_STMT_EXPR
+#ifdef HAVE_STMT_EXPR_NON_EXISTING
// GCC extension to define a function as a preprocessor macro
#define simple_hash(name) ({ \
#endif /* HAVE_STMT_EXPR */
+static inline long str2l(const char *s) {
+ register long n = 0;
+ register char c, negative = (*s == '-');
+
+ for(c = (negative)?*(++s):*s; c >= '0' && c <= '9' ; c = *(++s)) {
+ n *= 10;
+ n += c - '0';
+ }
+
+ if(unlikely(negative))
+ return -n;
+
+ return n;
+}
+
+static inline unsigned long str2ul(const char *s) {
+ register unsigned long n = 0;
+ register char c;
+ for(c = *s; c >= '0' && c <= '9' ; c = *(++s)) {
+ n *= 10;
+ n += c - '0';
+ }
+ return n;
+}
+
+static inline unsigned long long str2ull(const char *s) {
+ register unsigned long long n = 0;
+ register char c;
+ for(c = *s; c >= '0' && c <= '9' ; c = *(++s)) {
+ n *= 10;
+ n += c - '0';
+ }
+ return n;
+}
+
static inline int read_single_number_file(const char *filename, unsigned long long *result) {
char buffer[1024 + 1];
char *s = procfile_lineword(ff, i, 0);
uint32_t hash = simple_hash(s);
- if(unlikely(hash == user_hash && !strcmp(s, "user"))) {
- cp->user = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ if(unlikely(hash == user_hash && !strcmp(s, "user")))
+ cp->user = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == system_hash && !strcmp(s, "system"))) {
- cp->system = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == system_hash && !strcmp(s, "system")))
+ cp->system = str2ull(procfile_lineword(ff, i, 1));
}
cp->updated = 1;
unsigned long long total = 0;
for(i = 0; i < ca->cpus ;i++) {
- unsigned long long n = strtoull(procfile_lineword(ff, 0, i), NULL, 10);
+ unsigned long long n = str2ull(procfile_lineword(ff, 0, i));
ca->cpu_percpu[i] = n;
total += n;
}
char *s = procfile_lineword(ff, i, 1);
uint32_t hash = simple_hash(s);
- if(unlikely(hash == Read_hash && !strcmp(s, "Read"))) {
- io->Read += strtoull(procfile_lineword(ff, i, 2), NULL, 10);
- continue;
- }
+ if(unlikely(hash == Read_hash && !strcmp(s, "Read")))
+ io->Read += str2ull(procfile_lineword(ff, i, 2));
- if(unlikely(hash == Write_hash && !strcmp(s, "Write"))) {
- io->Write += strtoull(procfile_lineword(ff, i, 2), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == Write_hash && !strcmp(s, "Write")))
+ io->Write += str2ull(procfile_lineword(ff, i, 2));
/*
- if(hash == Sync_hash && !strcmp(s, "Sync")) {
- io->Sync += strtoull(procfile_lineword(ff, i, 2), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == Sync_hash && !strcmp(s, "Sync")))
+ io->Sync += str2ull(procfile_lineword(ff, i, 2));
- if(hash == Async_hash && !strcmp(s, "Async")) {
- io->Async += strtoull(procfile_lineword(ff, i, 2), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == Async_hash && !strcmp(s, "Async")))
+ io->Async += str2ull(procfile_lineword(ff, i, 2));
- if(hash == Total_hash && !strcmp(s, "Total")) {
- io->Total += strtoull(procfile_lineword(ff, i, 2), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == Total_hash && !strcmp(s, "Total")))
+ io->Total += str2ull(procfile_lineword(ff, i, 2));
*/
}
char *s = procfile_lineword(ff, i, 0);
uint32_t hash = simple_hash(s);
- if(unlikely(hash == cache_hash && !strcmp(s, "cache"))) {
- mem->cache = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ if(unlikely(hash == cache_hash && !strcmp(s, "cache")))
+ mem->cache = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == rss_hash && !strcmp(s, "rss"))) {
- mem->rss = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == rss_hash && !strcmp(s, "rss")))
+ mem->rss = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == rss_huge_hash && !strcmp(s, "rss_huge"))) {
- mem->rss_huge = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == rss_huge_hash && !strcmp(s, "rss_huge")))
+ mem->rss_huge = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == mapped_file_hash && !strcmp(s, "mapped_file"))) {
- mem->mapped_file = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == mapped_file_hash && !strcmp(s, "mapped_file")))
+ mem->mapped_file = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == writeback_hash && !strcmp(s, "writeback"))) {
- mem->writeback = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == writeback_hash && !strcmp(s, "writeback")))
+ mem->writeback = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == dirty_hash && !strcmp(s, "dirty"))) {
- mem->dirty = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
+ else if(unlikely(hash == dirty_hash && !strcmp(s, "dirty"))) {
+ mem->dirty = str2ull(procfile_lineword(ff, i, 1));
mem->detailed_has_dirty = 1;
- continue;
}
- if(unlikely(hash == swap_hash && !strcmp(s, "swap"))) {
- mem->swap = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
+ else if(unlikely(hash == swap_hash && !strcmp(s, "swap"))) {
+ mem->swap = str2ull(procfile_lineword(ff, i, 1));
mem->detailed_has_swap = 1;
- continue;
}
- if(unlikely(hash == pgpgin_hash && !strcmp(s, "pgpgin"))) {
- mem->pgpgin = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == pgpgin_hash && !strcmp(s, "pgpgin")))
+ mem->pgpgin = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == pgpgout_hash && !strcmp(s, "pgpgout"))) {
- mem->pgpgout = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == pgpgout_hash && !strcmp(s, "pgpgout")))
+ mem->pgpgout = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == pgfault_hash && !strcmp(s, "pgfault"))) {
- mem->pgfault = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == pgfault_hash && !strcmp(s, "pgfault")))
+ mem->pgfault = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == pgmajfault_hash && !strcmp(s, "pgmajfault"))) {
- mem->pgmajfault = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == pgmajfault_hash && !strcmp(s, "pgmajfault")))
+ mem->pgmajfault = str2ull(procfile_lineword(ff, i, 1));
/*
- if(unlikely(hash == inactive_anon_hash && !strcmp(s, "inactive_anon"))) {
- mem->inactive_anon = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == inactive_anon_hash && !strcmp(s, "inactive_anon")))
+ mem->inactive_anon = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == active_anon_hash && !strcmp(s, "active_anon"))) {
- mem->active_anon = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == active_anon_hash && !strcmp(s, "active_anon")))
+ mem->active_anon = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == inactive_file_hash && !strcmp(s, "inactive_file"))) {
- mem->inactive_file = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == inactive_file_hash && !strcmp(s, "inactive_file")))
+ mem->inactive_file = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == active_file_hash && !strcmp(s, "active_file"))) {
- mem->active_file = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == active_file_hash && !strcmp(s, "active_file")))
+ mem->active_file = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == unevictable_hash && !strcmp(s, "unevictable"))) {
- mem->unevictable = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == unevictable_hash && !strcmp(s, "unevictable")))
+ mem->unevictable = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == hierarchical_memory_limit_hash && !strcmp(s, "hierarchical_memory_limit"))) {
- mem->hierarchical_memory_limit = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == hierarchical_memory_limit_hash && !strcmp(s, "hierarchical_memory_limit")))
+ mem->hierarchical_memory_limit = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == total_cache_hash && !strcmp(s, "total_cache"))) {
- mem->total_cache = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == total_cache_hash && !strcmp(s, "total_cache")))
+ mem->total_cache = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == total_rss_hash && !strcmp(s, "total_rss"))) {
- mem->total_rss = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == total_rss_hash && !strcmp(s, "total_rss")))
+ mem->total_rss = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == total_rss_huge_hash && !strcmp(s, "total_rss_huge"))) {
- mem->total_rss_huge = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == total_rss_huge_hash && !strcmp(s, "total_rss_huge")))
+ mem->total_rss_huge = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == total_mapped_file_hash && !strcmp(s, "total_mapped_file"))) {
- mem->total_mapped_file = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == total_mapped_file_hash && !strcmp(s, "total_mapped_file")))
+ mem->total_mapped_file = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == total_writeback_hash && !strcmp(s, "total_writeback"))) {
- mem->total_writeback = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == total_writeback_hash && !strcmp(s, "total_writeback")))
+ mem->total_writeback = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == total_dirty_hash && !strcmp(s, "total_dirty"))) {
- mem->total_dirty = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == total_dirty_hash && !strcmp(s, "total_dirty")))
+ mem->total_dirty = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == total_swap_hash && !strcmp(s, "total_swap"))) {
- mem->total_swap = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == total_swap_hash && !strcmp(s, "total_swap")))
+ mem->total_swap = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == total_pgpgin_hash && !strcmp(s, "total_pgpgin"))) {
- mem->total_pgpgin = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == total_pgpgin_hash && !strcmp(s, "total_pgpgin")))
+ mem->total_pgpgin = str2ull(procfile_lineword(ff, i, 1), NULL, 10);
- if(unlikely(hash == total_pgpgout_hash && !strcmp(s, "total_pgpgout"))) {
- mem->total_pgpgout = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == total_pgpgout_hash && !strcmp(s, "total_pgpgout")))
+ mem->total_pgpgout = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == total_pgfault_hash && !strcmp(s, "total_pgfault"))) {
- mem->total_pgfault = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == total_pgfault_hash && !strcmp(s, "total_pgfault")))
+ mem->total_pgfault = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == total_pgmajfault_hash && !strcmp(s, "total_pgmajfault"))) {
- mem->total_pgmajfault = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == total_pgmajfault_hash && !strcmp(s, "total_pgmajfault")))
+ mem->total_pgmajfault = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == total_inactive_anon_hash && !strcmp(s, "total_inactive_anon"))) {
- mem->total_inactive_anon = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == total_inactive_anon_hash && !strcmp(s, "total_inactive_anon")))
+ mem->total_inactive_anon = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == total_active_anon_hash && !strcmp(s, "total_active_anon"))) {
- mem->total_active_anon = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == total_active_anon_hash && !strcmp(s, "total_active_anon")))
+ mem->total_active_anon = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == total_inactive_file_hash && !strcmp(s, "total_inactive_file"))) {
- mem->total_inactive_file = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == total_inactive_file_hash && !strcmp(s, "total_inactive_file")))
+ mem->total_inactive_file = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == total_active_file_hash && !strcmp(s, "total_active_file"))) {
- mem->total_active_file = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == total_active_file_hash && !strcmp(s, "total_active_file")))
+ mem->total_active_file = str2ull(procfile_lineword(ff, i, 1));
- if(unlikely(hash == total_unevictable_hash && !strcmp(s, "total_unevictable"))) {
- mem->total_unevictable = strtoull(procfile_lineword(ff, i, 1), NULL, 10);
- continue;
- }
+ else if(unlikely(hash == total_unevictable_hash && !strcmp(s, "total_unevictable")))
+ mem->total_unevictable = str2ull(procfile_lineword(ff, i, 1));
*/
}