return pid_max;
}
- pid_max = (pid_t)atoi(procfile_lineword(ff, 0, 0));
+ pid_max = (pid_t)str2i(procfile_lineword(ff, 0, 0));
if(!pid_max) {
procfile_close(ff);
pid_max = 32768;
ae->info = strdupz(pointers[20]);
if(!*ae->info) { freez(ae->info); ae->info = NULL; }
- ae->exec_code = atoi(pointers[21]);
- ae->new_status = atoi(pointers[22]);
- ae->old_status = atoi(pointers[23]);
- ae->delay = atoi(pointers[24]);
+ ae->exec_code = str2i(pointers[21]);
+ ae->new_status = str2i(pointers[22]);
+ ae->old_status = str2i(pointers[23]);
+ ae->delay = str2i(pointers[24]);
- ae->new_value = strtold(pointers[25], NULL);
- ae->old_value = strtold(pointers[26], NULL);
+ ae->new_value = str2l(pointers[25]);
+ ae->old_value = str2l(pointers[26]);
// add it to host if not already there
if(unlikely(*pointers[0] == 'A')) {
#endif /* HAVE_STMT_EXPR */
+static inline int str2i(const char *s) {
+ register int 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 long str2l(const char *s) {
register long n = 0;
register char c, negative = (*s == '-');
}
close(fd);
- *result = strtoull(buffer, NULL, 0);
+ *result = str2ull(buffer);
return 0;
}
if(procfile_lines(ff) >= 1 && procfile_linewords(ff, 0) >= 4) {
lim->semvmx = SEMVMX;
- lim->semmsl = atoi(procfile_lineword(ff, 0, 0));
- lim->semmns = atoi(procfile_lineword(ff, 0, 1));
- lim->semopm = atoi(procfile_lineword(ff, 0, 2));
- lim->semmni = atoi(procfile_lineword(ff, 0, 3));
+ lim->semmsl = str2i(procfile_lineword(ff, 0, 0));
+ lim->semmns = str2i(procfile_lineword(ff, 0, 1));
+ lim->semopm = str2i(procfile_lineword(ff, 0, 2));
+ lim->semmni = str2i(procfile_lineword(ff, 0, 3));
return 0;
}
else {
else if(unlikely(device && class && first_hash == SENT_HASH && strcmp(words[0], "Sent") == 0)) {
// debug(D_TC_LOOP, "SENT line '%s'", words[1]);
if(likely(words[1] && *words[1])) {
- class->bytes = strtoull(words[1], NULL, 10);
+ class->bytes = str2ull(words[1]);
class->updated = 1;
}
else {
}
if(likely(words[3] && *words[3]))
- class->packets = strtoull(words[3], NULL, 10);
+ class->packets = str2ull(words[3]);
if(likely(words[6] && *words[6]))
- class->dropped = strtoull(words[6], NULL, 10);
+ class->dropped = str2ull(words[6]);
if(likely(words[8] && *words[8]))
- class->overlimits = strtoull(words[8], NULL, 10);
+ class->overlimits = str2ull(words[8]);
if(likely(words[10] && *words[10]))
- class->requeues = strtoull(words[8], NULL, 10);
+ class->requeues = str2ull(words[8]);
}
else if(unlikely(device && class && class->updated && first_hash == LENDED_HASH && strcmp(words[0], "lended:") == 0)) {
// debug(D_TC_LOOP, "LENDED line '%s'", words[1]);
if(likely(words[1] && *words[1]))
- class->lended = strtoull(words[1], NULL, 10);
+ class->lended = str2ull(words[1]);
if(likely(words[3] && *words[3]))
- class->borrowed = strtoull(words[3], NULL, 10);
+ class->borrowed = str2ull(words[3]);
if(likely(words[5] && *words[5]))
- class->giants = strtoull(words[5], NULL, 10);
+ class->giants = str2ull(words[5]);
}
else if(unlikely(device && class && class->updated && first_hash == TOKENS_HASH && strcmp(words[0], "tokens:") == 0)) {
// debug(D_TC_LOOP, "TOKENS line '%s'", words[1]);
if(likely(words[1] && *words[1]))
- class->tokens = strtoull(words[1], NULL, 10);
+ class->tokens = str2ull(words[1]);
if(likely(words[3] && *words[3]))
- class->ctokens = strtoull(words[3], NULL, 10);
+ class->ctokens = str2ull(words[3]);
}
else if(unlikely(device && first_hash == SETDEVICENAME_HASH && strcmp(words[0], "SETDEVICENAME") == 0)) {
// debug(D_TC_LOOP, "SETDEVICENAME line '%s'", words[1]);
if(likely(st->counter_done)) {
usec_t microseconds = 0;
- if(microseconds_txt && *microseconds_txt) microseconds = strtoull(microseconds_txt, NULL, 10);
+ if(microseconds_txt && *microseconds_txt) microseconds = str2ull(microseconds_txt);
if(microseconds) rrdset_next_usec(st, microseconds);
else rrdset_next(st);
}
}
int priority = 1000;
- if(likely(priority_s)) priority = atoi(priority_s);
+ if(likely(priority_s)) priority = str2i(priority_s);
int update_every = cd->update_every;
- if(likely(update_every_s)) update_every = atoi(update_every_s);
+ if(likely(update_every_s)) update_every = str2i(update_every_s);
if(unlikely(!update_every)) update_every = cd->update_every;
int chart_type = RRDSET_TYPE_LINE;
char *tmp = fgets(buffer2, 1024, fpss);
if(likely(tmp)) {
- d->sector_size = atoi(tmp);
+ d->sector_size = str2i(tmp);
if(unlikely(d->sector_size <= 0)) {
error("Invalid sector size %d for device %s in %s. Assuming 512.", d->sector_size, d->disk, buffer);
d->sector_size = 512;
uint32_t words = procfile_linewords(ff, l);
if(unlikely(words < 14)) continue;
- major = strtoul(procfile_lineword(ff, l, 0), NULL, 10);
- minor = strtoul(procfile_lineword(ff, l, 1), NULL, 10);
+ major = str2ul(procfile_lineword(ff, l, 0));
+ minor = str2ul(procfile_lineword(ff, l, 1));
disk = procfile_lineword(ff, l, 2);
// # of reads completed # of writes completed
// This is the total number of reads or writes completed successfully.
- reads = strtoull(procfile_lineword(ff, l, 3), NULL, 10); // rd_ios
- writes = strtoull(procfile_lineword(ff, l, 7), NULL, 10); // wr_ios
+ reads = str2ull(procfile_lineword(ff, l, 3)); // rd_ios
+ writes = str2ull(procfile_lineword(ff, l, 7)); // wr_ios
// # of reads merged # of writes merged
// Reads and writes which are adjacent to each other may be merged for
// efficiency. Thus two 4K reads may become one 8K read before it is
// ultimately handed to the disk, and so it will be counted (and queued)
- mreads = strtoull(procfile_lineword(ff, l, 4), NULL, 10); // rd_merges_or_rd_sec
- mwrites = strtoull(procfile_lineword(ff, l, 8), NULL, 10); // wr_merges
+ mreads = str2ull(procfile_lineword(ff, l, 4)); // rd_merges_or_rd_sec
+ mwrites = str2ull(procfile_lineword(ff, l, 8)); // wr_merges
// # of sectors read # of sectors written
// This is the total number of sectors read or written successfully.
- readsectors = strtoull(procfile_lineword(ff, l, 5), NULL, 10); // rd_sec_or_wr_ios
- writesectors = strtoull(procfile_lineword(ff, l, 9), NULL, 10); // wr_sec
+ readsectors = str2ull(procfile_lineword(ff, l, 5)); // rd_sec_or_wr_ios
+ writesectors = str2ull(procfile_lineword(ff, l, 9)); // wr_sec
// # of milliseconds spent reading # of milliseconds spent writing
// This is the total number of milliseconds spent by all reads or writes (as
// measured from __make_request() to end_that_request_last()).
- readms = strtoull(procfile_lineword(ff, l, 6), NULL, 10); // rd_ticks_or_wr_sec
- writems = strtoull(procfile_lineword(ff, l, 10), NULL, 10); // wr_ticks
+ readms = str2ull(procfile_lineword(ff, l, 6)); // rd_ticks_or_wr_sec
+ writems = str2ull(procfile_lineword(ff, l, 10)); // wr_ticks
// # of I/Os currently in progress
// The only field that should go to zero. Incremented as requests are
// given to appropriate struct request_queue and decremented as they finish.
- queued_ios = strtoull(procfile_lineword(ff, l, 11), NULL, 10); // ios_pgr
+ queued_ios = str2ull(procfile_lineword(ff, l, 11)); // ios_pgr
// # of milliseconds spent doing I/Os
// This field increases so long as field queued_ios is nonzero.
- busy_ms = strtoull(procfile_lineword(ff, l, 12), NULL, 10); // tot_ticks
+ busy_ms = str2ull(procfile_lineword(ff, l, 12)); // tot_ticks
// weighted # of milliseconds spent doing I/Os
// This field is incremented at each I/O start, I/O completion, I/O
// (field queued_ios) times the number of milliseconds spent doing I/O since the
// last update of this field. This can provide an easy measure of both
// I/O completion time and the backlog that may be accumulating.
- backlog_ms = strtoull(procfile_lineword(ff, l, 13), NULL, 10); // rq_ticks
+ backlog_ms = str2ull(procfile_lineword(ff, l, 13)); // rq_ticks
// --------------------------------------------------------------------------
int c;
for(c = 0; c < cpus ;c++) {
if(likely((c + 1) < (int)words))
- irr->cpu[c].value = strtoull(procfile_lineword(ff, l, (uint32_t)(c + 1)), NULL, 10);
+ irr->cpu[c].value = str2ull(procfile_lineword(ff, l, (uint32_t)(c + 1)));
else
irr->cpu[c].value = 0;
double load5 = strtod(procfile_lineword(ff, 0, 1), NULL);
double load15 = strtod(procfile_lineword(ff, 0, 2), NULL);
- //unsigned long long running_processes = strtoull(procfile_lineword(ff, 0, 3), NULL, 10);
- unsigned long long active_processes = strtoull(procfile_lineword(ff, 0, 4), NULL, 10);
- //unsigned long long next_pid = strtoull(procfile_lineword(ff, 0, 5), NULL, 10);
+ //unsigned long long running_processes = str2ull(procfile_lineword(ff, 0, 3));
+ unsigned long long active_processes = str2ull(procfile_lineword(ff, 0, 4));
+ //unsigned long long next_pid = str2ull(procfile_lineword(ff, 0, 5));
// --------------------------------------------------------------------
//DirectMap2M = 0,
HardwareCorrupted = 0;
+ unsigned long long *value = NULL;
for(l = 0; l < lines ;l++) {
uint32_t words = procfile_linewords(ff, l);
if(unlikely(words < 2)) continue;
char *name = procfile_lineword(ff, l, 0);
uint32_t hash = simple_hash(name);
- unsigned long long value = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
-
- if(hash == MemTotal_hash && strcmp(name, "MemTotal") == 0) MemTotal = value;
- else if(hash == MemFree_hash && strcmp(name, "MemFree") == 0) MemFree = value;
- else if(hash == Buffers_hash && strcmp(name, "Buffers") == 0) Buffers = value;
- else if(hash == Cached_hash && strcmp(name, "Cached") == 0) Cached = value;
- //else if(hash == SwapCached_hash && strcmp(name, "SwapCached") == 0) SwapCached = value;
- //else if(hash == Active_hash && strcmp(name, "Active") == 0) Active = value;
- //else if(hash == Inactive_hash && strcmp(name, "Inactive") == 0) Inactive = value;
- //else if(hash == ActiveAnon_hash && strcmp(name, "ActiveAnon") == 0) ActiveAnon = value;
- //else if(hash == InactiveAnon_hash && strcmp(name, "InactiveAnon") == 0) InactiveAnon = value;
- //else if(hash == ActiveFile_hash && strcmp(name, "ActiveFile") == 0) ActiveFile = value;
- //else if(hash == InactiveFile_hash && strcmp(name, "InactiveFile") == 0) InactiveFile = value;
- //else if(hash == Unevictable_hash && strcmp(name, "Unevictable") == 0) Unevictable = value;
- //else if(hash == Mlocked_hash && strcmp(name, "Mlocked") == 0) Mlocked = value;
- else if(hash == SwapTotal_hash && strcmp(name, "SwapTotal") == 0) SwapTotal = value;
- else if(hash == SwapFree_hash && strcmp(name, "SwapFree") == 0) SwapFree = value;
- else if(hash == Dirty_hash && strcmp(name, "Dirty") == 0) Dirty = value;
- else if(hash == Writeback_hash && strcmp(name, "Writeback") == 0) Writeback = value;
- //else if(hash == AnonPages_hash && strcmp(name, "AnonPages") == 0) AnonPages = value;
- //else if(hash == Mapped_hash && strcmp(name, "Mapped") == 0) Mapped = value;
- //else if(hash == Shmem_hash && strcmp(name, "Shmem") == 0) Shmem = value;
- else if(hash == Slab_hash && strcmp(name, "Slab") == 0) Slab = value;
- else if(hash == SReclaimable_hash && strcmp(name, "SReclaimable") == 0) SReclaimable = value;
- else if(hash == SUnreclaim_hash && strcmp(name, "SUnreclaim") == 0) SUnreclaim = value;
- else if(hash == KernelStack_hash && strcmp(name, "KernelStack") == 0) KernelStack = value;
- else if(hash == PageTables_hash && strcmp(name, "PageTables") == 0) PageTables = value;
- else if(hash == NFS_Unstable_hash && strcmp(name, "NFS_Unstable") == 0) NFS_Unstable = value;
- else if(hash == Bounce_hash && strcmp(name, "Bounce") == 0) Bounce = value;
- else if(hash == WritebackTmp_hash && strcmp(name, "WritebackTmp") == 0) WritebackTmp = value;
- //else if(hash == CommitLimit_hash && strcmp(name, "CommitLimit") == 0) CommitLimit = value;
- else if(hash == Committed_AS_hash && strcmp(name, "Committed_AS") == 0) Committed_AS = value;
- //else if(hash == VmallocTotal_hash && strcmp(name, "VmallocTotal") == 0) VmallocTotal = value;
- else if(hash == VmallocUsed_hash && strcmp(name, "VmallocUsed") == 0) VmallocUsed = value;
- //else if(hash == VmallocChunk_hash && strcmp(name, "VmallocChunk") == 0) VmallocChunk = value;
- else if(hash == HardwareCorrupted_hash && strcmp(name, "HardwareCorrupted") == 0) { HardwareCorrupted = value; hwcorrupted = 1; }
- //else if(hash == AnonHugePages_hash && strcmp(name, "AnonHugePages") == 0) AnonHugePages = value;
- //else if(hash == HugePages_Total_hash && strcmp(name, "HugePages_Total") == 0) HugePages_Total = value;
- //else if(hash == HugePages_Free_hash && strcmp(name, "HugePages_Free") == 0) HugePages_Free = value;
- //else if(hash == HugePages_Rsvd_hash && strcmp(name, "HugePages_Rsvd") == 0) HugePages_Rsvd = value;
- //else if(hash == HugePages_Surp_hash && strcmp(name, "HugePages_Surp") == 0) HugePages_Surp = value;
- //else if(hash == Hugepagesize_hash && strcmp(name, "Hugepagesize") == 0) Hugepagesize = value;
- //else if(hash == DirectMap4k_hash && strcmp(name, "DirectMap4k") == 0) DirectMap4k = value;
- //else if(hash == DirectMap2M_hash && strcmp(name, "DirectMap2M") == 0) DirectMap2M = value;
+
+ if(hash == MemTotal_hash && strcmp(name, "MemTotal") == 0) value = &MemTotal;
+ else if(hash == MemFree_hash && strcmp(name, "MemFree") == 0) value = &MemFree;
+ else if(hash == Buffers_hash && strcmp(name, "Buffers") == 0) value = &Buffers;
+ else if(hash == Cached_hash && strcmp(name, "Cached") == 0) value = &Cached;
+ //else if(hash == SwapCached_hash && strcmp(name, "SwapCached") == 0) value = &SwapCached;
+ //else if(hash == Active_hash && strcmp(name, "Active") == 0) value = &Active;
+ //else if(hash == Inactive_hash && strcmp(name, "Inactive") == 0) value = &Inactive;
+ //else if(hash == ActiveAnon_hash && strcmp(name, "ActiveAnon") == 0) value = &ActiveAnon;
+ //else if(hash == InactiveAnon_hash && strcmp(name, "InactiveAnon") == 0) value = &InactiveAnon;
+ //else if(hash == ActiveFile_hash && strcmp(name, "ActiveFile") == 0) value = &ActiveFile;
+ //else if(hash == InactiveFile_hash && strcmp(name, "InactiveFile") == 0) value = &InactiveFile;
+ //else if(hash == Unevictable_hash && strcmp(name, "Unevictable") == 0) value = &Unevictable;
+ //else if(hash == Mlocked_hash && strcmp(name, "Mlocked") == 0) value = &Mlocked;
+ else if(hash == SwapTotal_hash && strcmp(name, "SwapTotal") == 0) value = &SwapTotal;
+ else if(hash == SwapFree_hash && strcmp(name, "SwapFree") == 0) value = &SwapFree;
+ else if(hash == Dirty_hash && strcmp(name, "Dirty") == 0) value = &Dirty;
+ else if(hash == Writeback_hash && strcmp(name, "Writeback") == 0) value = &Writeback;
+ //else if(hash == AnonPages_hash && strcmp(name, "AnonPages") == 0) value = &AnonPages;
+ //else if(hash == Mapped_hash && strcmp(name, "Mapped") == 0) value = &Mapped;
+ //else if(hash == Shmem_hash && strcmp(name, "Shmem") == 0) value = &Shmem;
+ else if(hash == Slab_hash && strcmp(name, "Slab") == 0) value = &Slab;
+ else if(hash == SReclaimable_hash && strcmp(name, "SReclaimable") == 0) value = &SReclaimable;
+ else if(hash == SUnreclaim_hash && strcmp(name, "SUnreclaim") == 0) value = &SUnreclaim;
+ else if(hash == KernelStack_hash && strcmp(name, "KernelStack") == 0) value = &KernelStack;
+ else if(hash == PageTables_hash && strcmp(name, "PageTables") == 0) value = &PageTables;
+ else if(hash == NFS_Unstable_hash && strcmp(name, "NFS_Unstable") == 0) value = &NFS_Unstable;
+ else if(hash == Bounce_hash && strcmp(name, "Bounce") == 0) value = &Bounce;
+ else if(hash == WritebackTmp_hash && strcmp(name, "WritebackTmp") == 0) value = &WritebackTmp;
+ //else if(hash == CommitLimit_hash && strcmp(name, "CommitLimit") == 0) value = &CommitLimit;
+ else if(hash == Committed_AS_hash && strcmp(name, "Committed_AS") == 0) value = &Committed_AS;
+ //else if(hash == VmallocTotal_hash && strcmp(name, "VmallocTotal") == 0) value = &VmallocTotal;
+ else if(hash == VmallocUsed_hash && strcmp(name, "VmallocUsed") == 0) value = &VmallocUsed;
+ //else if(hash == VmallocChunk_hash && strcmp(name, "VmallocChunk") == 0) value = &VmallocChunk;
+ else if(hash == HardwareCorrupted_hash && strcmp(name, "HardwareCorrupted") == 0) { value = &HardwareCorrupted; hwcorrupted = 1; }
+ //else if(hash == AnonHugePages_hash && strcmp(name, "AnonHugePages") == 0) value = &AnonHugePages;
+ //else if(hash == HugePages_Total_hash && strcmp(name, "HugePages_Total") == 0) value = &HugePages_Total;
+ //else if(hash == HugePages_Free_hash && strcmp(name, "HugePages_Free") == 0) value = &HugePages_Free;
+ //else if(hash == HugePages_Rsvd_hash && strcmp(name, "HugePages_Rsvd") == 0) value = &HugePages_Rsvd;
+ //else if(hash == HugePages_Surp_hash && strcmp(name, "HugePages_Surp") == 0) value = &HugePages_Surp;
+ //else if(hash == Hugepagesize_hash && strcmp(name, "Hugepagesize") == 0) value = &Hugepagesize;
+ //else if(hash == DirectMap4k_hash && strcmp(name, "DirectMap4k") == 0) value = &DirectMap4k;
+ //else if(hash == DirectMap2M_hash && strcmp(name, "DirectMap2M") == 0) value = &DirectMap2M;
+
+ if(value) {
+ *value = str2ull(procfile_lineword(ff, l, 1));
+ value = NULL;
+ }
}
RRDSET *st;
if(unlikely(!d->enabled))
continue;
- d->rbytes = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
- d->rpackets = strtoull(procfile_lineword(ff, l, 2), NULL, 10);
- d->rerrors = strtoull(procfile_lineword(ff, l, 3), NULL, 10);
- d->rdrops = strtoull(procfile_lineword(ff, l, 4), NULL, 10);
- d->rfifo = strtoull(procfile_lineword(ff, l, 5), NULL, 10);
- d->rframe = strtoull(procfile_lineword(ff, l, 6), NULL, 10);
- d->rcompressed = strtoull(procfile_lineword(ff, l, 7), NULL, 10);
- d->rmulticast = strtoull(procfile_lineword(ff, l, 8), NULL, 10);
-
- d->tbytes = strtoull(procfile_lineword(ff, l, 9), NULL, 10);
- d->tpackets = strtoull(procfile_lineword(ff, l, 10), NULL, 10);
- d->terrors = strtoull(procfile_lineword(ff, l, 11), NULL, 10);
- d->tdrops = strtoull(procfile_lineword(ff, l, 12), NULL, 10);
- d->tfifo = strtoull(procfile_lineword(ff, l, 13), NULL, 10);
- d->tcollisions = strtoull(procfile_lineword(ff, l, 14), NULL, 10);
- d->tcarrier = strtoull(procfile_lineword(ff, l, 15), NULL, 10);
- d->tcompressed = strtoull(procfile_lineword(ff, l, 16), NULL, 10);
+ d->rbytes = str2ull(procfile_lineword(ff, l, 1));
+ d->rpackets = str2ull(procfile_lineword(ff, l, 2));
+ d->rerrors = str2ull(procfile_lineword(ff, l, 3));
+ d->rdrops = str2ull(procfile_lineword(ff, l, 4));
+ d->rfifo = str2ull(procfile_lineword(ff, l, 5));
+ d->rframe = str2ull(procfile_lineword(ff, l, 6));
+ d->rcompressed = str2ull(procfile_lineword(ff, l, 7));
+ d->rmulticast = str2ull(procfile_lineword(ff, l, 8));
+
+ d->tbytes = str2ull(procfile_lineword(ff, l, 9));
+ d->tpackets = str2ull(procfile_lineword(ff, l, 10));
+ d->terrors = str2ull(procfile_lineword(ff, l, 11));
+ d->tdrops = str2ull(procfile_lineword(ff, l, 12));
+ d->tfifo = str2ull(procfile_lineword(ff, l, 13));
+ d->tcollisions = str2ull(procfile_lineword(ff, l, 14));
+ d->tcarrier = str2ull(procfile_lineword(ff, l, 15));
+ d->tcompressed = str2ull(procfile_lineword(ff, l, 16));
// --------------------------------------------------------------------
for(i = 0 ; nc[i].name ;i++) {
if(unlikely(hash == nc[i].hash && !strcmp(key, nc[i].name))) {
- nc[i].value = strtoull(procfile_lineword(ff, values_line, w), NULL, 10);
+ nc[i].value = str2ull(procfile_lineword(ff, values_line, w));
break;
}
}
continue;
}
- net_count = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
- net_udp_count = strtoull(procfile_lineword(ff, l, 2), NULL, 10);
- net_tcp_count = strtoull(procfile_lineword(ff, l, 3), NULL, 10);
- net_tcp_connections = strtoull(procfile_lineword(ff, l, 4), NULL, 10);
+ net_count = str2ull(procfile_lineword(ff, l, 1));
+ net_udp_count = str2ull(procfile_lineword(ff, l, 2));
+ net_tcp_count = str2ull(procfile_lineword(ff, l, 3));
+ net_tcp_connections = str2ull(procfile_lineword(ff, l, 4));
unsigned long long sum = net_count + net_udp_count + net_tcp_count + net_tcp_connections;
if(sum == 0ULL) do_net = -1;
continue;
}
- rpc_calls = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
- rpc_retransmits = strtoull(procfile_lineword(ff, l, 2), NULL, 10);
- rpc_auth_refresh = strtoull(procfile_lineword(ff, l, 3), NULL, 10);
+ rpc_calls = str2ull(procfile_lineword(ff, l, 1));
+ rpc_retransmits = str2ull(procfile_lineword(ff, l, 2));
+ rpc_auth_refresh = str2ull(procfile_lineword(ff, l, 3));
unsigned long long sum = rpc_calls + rpc_retransmits + rpc_auth_refresh;
if(sum == 0ULL) do_rpc = -1;
unsigned long long sum = 0;
unsigned int i, j;
for(i = 0, j = 2; j < words && nfs_proc2_values[i].name[0] ; i++, j++) {
- nfs_proc2_values[i].value = strtoull(procfile_lineword(ff, l, j), NULL, 10);
+ nfs_proc2_values[i].value = str2ull(procfile_lineword(ff, l, j));
nfs_proc2_values[i].present = 1;
sum += nfs_proc2_values[i].value;
}
unsigned long long sum = 0;
unsigned int i, j;
for(i = 0, j = 2; j < words && nfs_proc3_values[i].name[0] ; i++, j++) {
- nfs_proc3_values[i].value = strtoull(procfile_lineword(ff, l, j), NULL, 10);
+ nfs_proc3_values[i].value = str2ull(procfile_lineword(ff, l, j));
nfs_proc3_values[i].present = 1;
sum += nfs_proc3_values[i].value;
}
unsigned long long sum = 0;
unsigned int i, j;
for(i = 0, j = 2; j < words && nfs_proc4_values[i].name[0] ; i++, j++) {
- nfs_proc4_values[i].value = strtoull(procfile_lineword(ff, l, j), NULL, 10);
+ nfs_proc4_values[i].value = str2ull(procfile_lineword(ff, l, j));
nfs_proc4_values[i].present = 1;
sum += nfs_proc4_values[i].value;
}
continue;
}
- rc_hits = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
- rc_misses = strtoull(procfile_lineword(ff, l, 2), NULL, 10);
- rc_nocache = strtoull(procfile_lineword(ff, l, 3), NULL, 10);
+ rc_hits = str2ull(procfile_lineword(ff, l, 1));
+ rc_misses = str2ull(procfile_lineword(ff, l, 2));
+ rc_nocache = str2ull(procfile_lineword(ff, l, 3));
unsigned long long sum = rc_hits + rc_misses + rc_nocache;
if(sum == 0ULL) do_rc = -1;
continue;
}
- fh_stale = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
- fh_total_lookups = strtoull(procfile_lineword(ff, l, 2), NULL, 10);
- fh_anonymous_lookups = strtoull(procfile_lineword(ff, l, 3), NULL, 10);
- fh_dir_not_in_dcache = strtoull(procfile_lineword(ff, l, 4), NULL, 10);
- fh_non_dir_not_in_dcache = strtoull(procfile_lineword(ff, l, 5), NULL, 10);
+ fh_stale = str2ull(procfile_lineword(ff, l, 1));
+ fh_total_lookups = str2ull(procfile_lineword(ff, l, 2));
+ fh_anonymous_lookups = str2ull(procfile_lineword(ff, l, 3));
+ fh_dir_not_in_dcache = str2ull(procfile_lineword(ff, l, 4));
+ fh_non_dir_not_in_dcache = str2ull(procfile_lineword(ff, l, 5));
unsigned long long sum = fh_stale + fh_total_lookups + fh_anonymous_lookups + fh_dir_not_in_dcache + fh_non_dir_not_in_dcache;
if(sum == 0ULL) do_fh = -1;
continue;
}
- io_read = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
- io_write = strtoull(procfile_lineword(ff, l, 2), NULL, 10);
+ io_read = str2ull(procfile_lineword(ff, l, 1));
+ io_write = str2ull(procfile_lineword(ff, l, 2));
unsigned long long sum = io_read + io_write;
if(sum == 0ULL) do_io = -1;
continue;
}
- th_threads = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
- th_fullcnt = strtoull(procfile_lineword(ff, l, 2), NULL, 10);
+ th_threads = str2ull(procfile_lineword(ff, l, 1));
+ th_fullcnt = str2ull(procfile_lineword(ff, l, 2));
th_hist10 = (unsigned long long)(atof(procfile_lineword(ff, l, 3)) * 1000.0);
th_hist20 = (unsigned long long)(atof(procfile_lineword(ff, l, 4)) * 1000.0);
th_hist30 = (unsigned long long)(atof(procfile_lineword(ff, l, 5)) * 1000.0);
continue;
}
- ra_size = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
- ra_hist10 = strtoull(procfile_lineword(ff, l, 2), NULL, 10);
- ra_hist20 = strtoull(procfile_lineword(ff, l, 3), NULL, 10);
- ra_hist30 = strtoull(procfile_lineword(ff, l, 4), NULL, 10);
- ra_hist40 = strtoull(procfile_lineword(ff, l, 5), NULL, 10);
- ra_hist50 = strtoull(procfile_lineword(ff, l, 6), NULL, 10);
- ra_hist60 = strtoull(procfile_lineword(ff, l, 7), NULL, 10);
- ra_hist70 = strtoull(procfile_lineword(ff, l, 8), NULL, 10);
- ra_hist80 = strtoull(procfile_lineword(ff, l, 9), NULL, 10);
- ra_hist90 = strtoull(procfile_lineword(ff, l, 10), NULL, 10);
- ra_hist100 = strtoull(procfile_lineword(ff, l, 11), NULL, 10);
- ra_none = strtoull(procfile_lineword(ff, l, 12), NULL, 10);
+ ra_size = str2ull(procfile_lineword(ff, l, 1));
+ ra_hist10 = str2ull(procfile_lineword(ff, l, 2));
+ ra_hist20 = str2ull(procfile_lineword(ff, l, 3));
+ ra_hist30 = str2ull(procfile_lineword(ff, l, 4));
+ ra_hist40 = str2ull(procfile_lineword(ff, l, 5));
+ ra_hist50 = str2ull(procfile_lineword(ff, l, 6));
+ ra_hist60 = str2ull(procfile_lineword(ff, l, 7));
+ ra_hist70 = str2ull(procfile_lineword(ff, l, 8));
+ ra_hist80 = str2ull(procfile_lineword(ff, l, 9));
+ ra_hist90 = str2ull(procfile_lineword(ff, l, 10));
+ ra_hist100 = str2ull(procfile_lineword(ff, l, 11));
+ ra_none = str2ull(procfile_lineword(ff, l, 12));
unsigned long long sum = ra_hist10 + ra_hist20 + ra_hist30 + ra_hist40 + ra_hist50 + ra_hist60 + ra_hist70 + ra_hist80 + ra_hist90 + ra_hist100 + ra_none;
if(sum == 0ULL) {
continue;
}
- net_count = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
- net_udp_count = strtoull(procfile_lineword(ff, l, 2), NULL, 10);
- net_tcp_count = strtoull(procfile_lineword(ff, l, 3), NULL, 10);
- net_tcp_connections = strtoull(procfile_lineword(ff, l, 4), NULL, 10);
+ net_count = str2ull(procfile_lineword(ff, l, 1));
+ net_udp_count = str2ull(procfile_lineword(ff, l, 2));
+ net_tcp_count = str2ull(procfile_lineword(ff, l, 3));
+ net_tcp_connections = str2ull(procfile_lineword(ff, l, 4));
unsigned long long sum = net_count + net_udp_count + net_tcp_count + net_tcp_connections;
if(sum == 0ULL) do_net = -1;
continue;
}
- rpc_calls = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
- rpc_bad_format = strtoull(procfile_lineword(ff, l, 2), NULL, 10);
- rpc_bad_auth = strtoull(procfile_lineword(ff, l, 3), NULL, 10);
- rpc_bad_client = strtoull(procfile_lineword(ff, l, 4), NULL, 10);
+ rpc_calls = str2ull(procfile_lineword(ff, l, 1));
+ rpc_bad_format = str2ull(procfile_lineword(ff, l, 2));
+ rpc_bad_auth = str2ull(procfile_lineword(ff, l, 3));
+ rpc_bad_client = str2ull(procfile_lineword(ff, l, 4));
unsigned long long sum = rpc_calls + rpc_bad_format + rpc_bad_auth + rpc_bad_client;
if(sum == 0ULL) do_rpc = -1;
unsigned long long sum = 0;
unsigned int i, j;
for(i = 0, j = 2; j < words && nfsd_proc2_values[i].name[0] ; i++, j++) {
- nfsd_proc2_values[i].value = strtoull(procfile_lineword(ff, l, j), NULL, 10);
+ nfsd_proc2_values[i].value = str2ull(procfile_lineword(ff, l, j));
nfsd_proc2_values[i].present = 1;
sum += nfsd_proc2_values[i].value;
}
unsigned long long sum = 0;
unsigned int i, j;
for(i = 0, j = 2; j < words && nfsd_proc3_values[i].name[0] ; i++, j++) {
- nfsd_proc3_values[i].value = strtoull(procfile_lineword(ff, l, j), NULL, 10);
+ nfsd_proc3_values[i].value = str2ull(procfile_lineword(ff, l, j));
nfsd_proc3_values[i].present = 1;
sum += nfsd_proc3_values[i].value;
}
unsigned long long sum = 0;
unsigned int i, j;
for(i = 0, j = 2; j < words && nfsd_proc4_values[i].name[0] ; i++, j++) {
- nfsd_proc4_values[i].value = strtoull(procfile_lineword(ff, l, j), NULL, 10);
+ nfsd_proc4_values[i].value = str2ull(procfile_lineword(ff, l, j));
nfsd_proc4_values[i].present = 1;
sum += nfsd_proc4_values[i].value;
}
unsigned long long sum = 0;
unsigned int i, j;
for(i = 0, j = 2; j < words && nfsd4_ops_values[i].name[0] ; i++, j++) {
- nfsd4_ops_values[i].value = strtoull(procfile_lineword(ff, l, j), NULL, 10);
+ nfsd4_ops_values[i].value = str2ull(procfile_lineword(ff, l, j));
nfsd4_ops_values[i].present = 1;
sum += nfsd4_ops_values[i].value;
}
for(i = 0 ; nc[i].name ;i++) {
if(unlikely(hash == nc[i].hash && !strcmp(key, nc[i].name))) {
- nc[i].value = strtoull(procfile_lineword(ff, values_line, w), NULL, 10);
+ nc[i].value = str2ull(procfile_lineword(ff, values_line, w));
break;
}
}
unsigned long long UdpLite6SndbufErrors = 0ULL;
unsigned long long UdpLite6InCsumErrors = 0ULL;
+ unsigned long long *ptr = NULL;
+
for(l = 0; l < lines ;l++) {
uint32_t words = procfile_linewords(ff, l);
if(unlikely(words < 2)) {
uint32_t hash = simple_hash(name);
- if(unlikely(hash == hash_Ip6InReceives && strcmp(name, "Ip6InReceives") == 0)) Ip6InReceives = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6InHdrErrors && strcmp(name, "Ip6InHdrErrors") == 0)) Ip6InHdrErrors = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6InTooBigErrors && strcmp(name, "Ip6InTooBigErrors") == 0)) Ip6InTooBigErrors = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6InNoRoutes && strcmp(name, "Ip6InNoRoutes") == 0)) Ip6InNoRoutes = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6InAddrErrors && strcmp(name, "Ip6InAddrErrors") == 0)) Ip6InAddrErrors = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6InUnknownProtos && strcmp(name, "Ip6InUnknownProtos") == 0)) Ip6InUnknownProtos = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6InTruncatedPkts && strcmp(name, "Ip6InTruncatedPkts") == 0)) Ip6InTruncatedPkts = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6InDiscards && strcmp(name, "Ip6InDiscards") == 0)) Ip6InDiscards = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6InDelivers && strcmp(name, "Ip6InDelivers") == 0)) Ip6InDelivers = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6OutForwDatagrams && strcmp(name, "Ip6OutForwDatagrams") == 0)) Ip6OutForwDatagrams = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6OutRequests && strcmp(name, "Ip6OutRequests") == 0)) Ip6OutRequests = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6OutDiscards && strcmp(name, "Ip6OutDiscards") == 0)) Ip6OutDiscards = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6OutNoRoutes && strcmp(name, "Ip6OutNoRoutes") == 0)) Ip6OutNoRoutes = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6ReasmTimeout && strcmp(name, "Ip6ReasmTimeout") == 0)) Ip6ReasmTimeout = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6ReasmReqds && strcmp(name, "Ip6ReasmReqds") == 0)) Ip6ReasmReqds = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6ReasmOKs && strcmp(name, "Ip6ReasmOKs") == 0)) Ip6ReasmOKs = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6ReasmFails && strcmp(name, "Ip6ReasmFails") == 0)) Ip6ReasmFails = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6FragOKs && strcmp(name, "Ip6FragOKs") == 0)) Ip6FragOKs = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6FragFails && strcmp(name, "Ip6FragFails") == 0)) Ip6FragFails = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6FragCreates && strcmp(name, "Ip6FragCreates") == 0)) Ip6FragCreates = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6InMcastPkts && strcmp(name, "Ip6InMcastPkts") == 0)) Ip6InMcastPkts = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6OutMcastPkts && strcmp(name, "Ip6OutMcastPkts") == 0)) Ip6OutMcastPkts = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6InOctets && strcmp(name, "Ip6InOctets") == 0)) Ip6InOctets = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6OutOctets && strcmp(name, "Ip6OutOctets") == 0)) Ip6OutOctets = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6InMcastOctets && strcmp(name, "Ip6InMcastOctets") == 0)) Ip6InMcastOctets = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6OutMcastOctets && strcmp(name, "Ip6OutMcastOctets") == 0)) Ip6OutMcastOctets = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6InBcastOctets && strcmp(name, "Ip6InBcastOctets") == 0)) Ip6InBcastOctets = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6OutBcastOctets && strcmp(name, "Ip6OutBcastOctets") == 0)) Ip6OutBcastOctets = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6InNoECTPkts && strcmp(name, "Ip6InNoECTPkts") == 0)) Ip6InNoECTPkts = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6InECT1Pkts && strcmp(name, "Ip6InECT1Pkts") == 0)) Ip6InECT1Pkts = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6InECT0Pkts && strcmp(name, "Ip6InECT0Pkts") == 0)) Ip6InECT0Pkts = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Ip6InCEPkts && strcmp(name, "Ip6InCEPkts") == 0)) Ip6InCEPkts = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6InMsgs && strcmp(name, "Icmp6InMsgs") == 0)) Icmp6InMsgs = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6InErrors && strcmp(name, "Icmp6InErrors") == 0)) Icmp6InErrors = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6OutMsgs && strcmp(name, "Icmp6OutMsgs") == 0)) Icmp6OutMsgs = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6OutErrors && strcmp(name, "Icmp6OutErrors") == 0)) Icmp6OutErrors = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6InCsumErrors && strcmp(name, "Icmp6InCsumErrors") == 0)) Icmp6InCsumErrors = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6InDestUnreachs && strcmp(name, "Icmp6InDestUnreachs") == 0)) Icmp6InDestUnreachs = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6InPktTooBigs && strcmp(name, "Icmp6InPktTooBigs") == 0)) Icmp6InPktTooBigs = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6InTimeExcds && strcmp(name, "Icmp6InTimeExcds") == 0)) Icmp6InTimeExcds = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6InParmProblems && strcmp(name, "Icmp6InParmProblems") == 0)) Icmp6InParmProblems = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6InEchos && strcmp(name, "Icmp6InEchos") == 0)) Icmp6InEchos = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6InEchoReplies && strcmp(name, "Icmp6InEchoReplies") == 0)) Icmp6InEchoReplies = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6InGroupMembQueries && strcmp(name, "Icmp6InGroupMembQueries") == 0)) Icmp6InGroupMembQueries = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6InGroupMembResponses && strcmp(name, "Icmp6InGroupMembResponses") == 0)) Icmp6InGroupMembResponses = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6InGroupMembReductions && strcmp(name, "Icmp6InGroupMembReductions") == 0)) Icmp6InGroupMembReductions = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6InRouterSolicits && strcmp(name, "Icmp6InRouterSolicits") == 0)) Icmp6InRouterSolicits = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6InRouterAdvertisements && strcmp(name, "Icmp6InRouterAdvertisements") == 0)) Icmp6InRouterAdvertisements = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6InNeighborSolicits && strcmp(name, "Icmp6InNeighborSolicits") == 0)) Icmp6InNeighborSolicits = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6InNeighborAdvertisements && strcmp(name, "Icmp6InNeighborAdvertisements") == 0)) Icmp6InNeighborAdvertisements = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6InRedirects && strcmp(name, "Icmp6InRedirects") == 0)) Icmp6InRedirects = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6InMLDv2Reports && strcmp(name, "Icmp6InMLDv2Reports") == 0)) Icmp6InMLDv2Reports = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6OutDestUnreachs && strcmp(name, "Icmp6OutDestUnreachs") == 0)) Icmp6OutDestUnreachs = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6OutPktTooBigs && strcmp(name, "Icmp6OutPktTooBigs") == 0)) Icmp6OutPktTooBigs = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6OutTimeExcds && strcmp(name, "Icmp6OutTimeExcds") == 0)) Icmp6OutTimeExcds = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6OutParmProblems && strcmp(name, "Icmp6OutParmProblems") == 0)) Icmp6OutParmProblems = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6OutEchos && strcmp(name, "Icmp6OutEchos") == 0)) Icmp6OutEchos = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6OutEchoReplies && strcmp(name, "Icmp6OutEchoReplies") == 0)) Icmp6OutEchoReplies = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6OutGroupMembQueries && strcmp(name, "Icmp6OutGroupMembQueries") == 0)) Icmp6OutGroupMembQueries = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6OutGroupMembResponses && strcmp(name, "Icmp6OutGroupMembResponses") == 0)) Icmp6OutGroupMembResponses = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6OutGroupMembReductions && strcmp(name, "Icmp6OutGroupMembReductions") == 0)) Icmp6OutGroupMembReductions = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6OutRouterSolicits && strcmp(name, "Icmp6OutRouterSolicits") == 0)) Icmp6OutRouterSolicits = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6OutRouterAdvertisements && strcmp(name, "Icmp6OutRouterAdvertisements") == 0)) Icmp6OutRouterAdvertisements = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6OutNeighborSolicits && strcmp(name, "Icmp6OutNeighborSolicits") == 0)) Icmp6OutNeighborSolicits = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6OutNeighborAdvertisements && strcmp(name, "Icmp6OutNeighborAdvertisements") == 0)) Icmp6OutNeighborAdvertisements = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6OutRedirects && strcmp(name, "Icmp6OutRedirects") == 0)) Icmp6OutRedirects = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6OutMLDv2Reports && strcmp(name, "Icmp6OutMLDv2Reports") == 0)) Icmp6OutMLDv2Reports = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6InType1 && strcmp(name, "Icmp6InType1") == 0)) Icmp6InType1 = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6InType128 && strcmp(name, "Icmp6InType128") == 0)) Icmp6InType128 = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6InType129 && strcmp(name, "Icmp6InType129") == 0)) Icmp6InType129 = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6InType136 && strcmp(name, "Icmp6InType136") == 0)) Icmp6InType136 = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6OutType1 && strcmp(name, "Icmp6OutType1") == 0)) Icmp6OutType1 = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6OutType128 && strcmp(name, "Icmp6OutType128") == 0)) Icmp6OutType128 = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6OutType129 && strcmp(name, "Icmp6OutType129") == 0)) Icmp6OutType129 = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6OutType133 && strcmp(name, "Icmp6OutType133") == 0)) Icmp6OutType133 = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6OutType135 && strcmp(name, "Icmp6OutType135") == 0)) Icmp6OutType135 = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Icmp6OutType143 && strcmp(name, "Icmp6OutType143") == 0)) Icmp6OutType143 = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Udp6InDatagrams && strcmp(name, "Udp6InDatagrams") == 0)) Udp6InDatagrams = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Udp6NoPorts && strcmp(name, "Udp6NoPorts") == 0)) Udp6NoPorts = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Udp6InErrors && strcmp(name, "Udp6InErrors") == 0)) Udp6InErrors = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Udp6OutDatagrams && strcmp(name, "Udp6OutDatagrams") == 0)) Udp6OutDatagrams = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Udp6RcvbufErrors && strcmp(name, "Udp6RcvbufErrors") == 0)) Udp6RcvbufErrors = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Udp6SndbufErrors && strcmp(name, "Udp6SndbufErrors") == 0)) Udp6SndbufErrors = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Udp6InCsumErrors && strcmp(name, "Udp6InCsumErrors") == 0)) Udp6InCsumErrors = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_Udp6IgnoredMulti && strcmp(name, "Udp6IgnoredMulti") == 0)) Udp6IgnoredMulti = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_UdpLite6InDatagrams && strcmp(name, "UdpLite6InDatagrams") == 0)) UdpLite6InDatagrams = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_UdpLite6NoPorts && strcmp(name, "UdpLite6NoPorts") == 0)) UdpLite6NoPorts = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_UdpLite6InErrors && strcmp(name, "UdpLite6InErrors") == 0)) UdpLite6InErrors = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_UdpLite6OutDatagrams && strcmp(name, "UdpLite6OutDatagrams") == 0)) UdpLite6OutDatagrams = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_UdpLite6RcvbufErrors && strcmp(name, "UdpLite6RcvbufErrors") == 0)) UdpLite6RcvbufErrors = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_UdpLite6SndbufErrors && strcmp(name, "UdpLite6SndbufErrors") == 0)) UdpLite6SndbufErrors = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_UdpLite6InCsumErrors && strcmp(name, "UdpLite6InCsumErrors") == 0)) UdpLite6InCsumErrors = strtoull(value, NULL, 10);
+ if(unlikely(hash == hash_Ip6InReceives && strcmp(name, "Ip6InReceives") == 0)) ptr = &Ip6InReceives;
+ else if(unlikely(hash == hash_Ip6InHdrErrors && strcmp(name, "Ip6InHdrErrors") == 0)) ptr = &Ip6InHdrErrors;
+ else if(unlikely(hash == hash_Ip6InTooBigErrors && strcmp(name, "Ip6InTooBigErrors") == 0)) ptr = &Ip6InTooBigErrors;
+ else if(unlikely(hash == hash_Ip6InNoRoutes && strcmp(name, "Ip6InNoRoutes") == 0)) ptr = &Ip6InNoRoutes;
+ else if(unlikely(hash == hash_Ip6InAddrErrors && strcmp(name, "Ip6InAddrErrors") == 0)) ptr = &Ip6InAddrErrors;
+ else if(unlikely(hash == hash_Ip6InUnknownProtos && strcmp(name, "Ip6InUnknownProtos") == 0)) ptr = &Ip6InUnknownProtos;
+ else if(unlikely(hash == hash_Ip6InTruncatedPkts && strcmp(name, "Ip6InTruncatedPkts") == 0)) ptr = &Ip6InTruncatedPkts;
+ else if(unlikely(hash == hash_Ip6InDiscards && strcmp(name, "Ip6InDiscards") == 0)) ptr = &Ip6InDiscards;
+ else if(unlikely(hash == hash_Ip6InDelivers && strcmp(name, "Ip6InDelivers") == 0)) ptr = &Ip6InDelivers;
+ else if(unlikely(hash == hash_Ip6OutForwDatagrams && strcmp(name, "Ip6OutForwDatagrams") == 0)) ptr = &Ip6OutForwDatagrams;
+ else if(unlikely(hash == hash_Ip6OutRequests && strcmp(name, "Ip6OutRequests") == 0)) ptr = &Ip6OutRequests;
+ else if(unlikely(hash == hash_Ip6OutDiscards && strcmp(name, "Ip6OutDiscards") == 0)) ptr = &Ip6OutDiscards;
+ else if(unlikely(hash == hash_Ip6OutNoRoutes && strcmp(name, "Ip6OutNoRoutes") == 0)) ptr = &Ip6OutNoRoutes;
+ else if(unlikely(hash == hash_Ip6ReasmTimeout && strcmp(name, "Ip6ReasmTimeout") == 0)) ptr = &Ip6ReasmTimeout;
+ else if(unlikely(hash == hash_Ip6ReasmReqds && strcmp(name, "Ip6ReasmReqds") == 0)) ptr = &Ip6ReasmReqds;
+ else if(unlikely(hash == hash_Ip6ReasmOKs && strcmp(name, "Ip6ReasmOKs") == 0)) ptr = &Ip6ReasmOKs;
+ else if(unlikely(hash == hash_Ip6ReasmFails && strcmp(name, "Ip6ReasmFails") == 0)) ptr = &Ip6ReasmFails;
+ else if(unlikely(hash == hash_Ip6FragOKs && strcmp(name, "Ip6FragOKs") == 0)) ptr = &Ip6FragOKs;
+ else if(unlikely(hash == hash_Ip6FragFails && strcmp(name, "Ip6FragFails") == 0)) ptr = &Ip6FragFails;
+ else if(unlikely(hash == hash_Ip6FragCreates && strcmp(name, "Ip6FragCreates") == 0)) ptr = &Ip6FragCreates;
+ else if(unlikely(hash == hash_Ip6InMcastPkts && strcmp(name, "Ip6InMcastPkts") == 0)) ptr = &Ip6InMcastPkts;
+ else if(unlikely(hash == hash_Ip6OutMcastPkts && strcmp(name, "Ip6OutMcastPkts") == 0)) ptr = &Ip6OutMcastPkts;
+ else if(unlikely(hash == hash_Ip6InOctets && strcmp(name, "Ip6InOctets") == 0)) ptr = &Ip6InOctets;
+ else if(unlikely(hash == hash_Ip6OutOctets && strcmp(name, "Ip6OutOctets") == 0)) ptr = &Ip6OutOctets;
+ else if(unlikely(hash == hash_Ip6InMcastOctets && strcmp(name, "Ip6InMcastOctets") == 0)) ptr = &Ip6InMcastOctets;
+ else if(unlikely(hash == hash_Ip6OutMcastOctets && strcmp(name, "Ip6OutMcastOctets") == 0)) ptr = &Ip6OutMcastOctets;
+ else if(unlikely(hash == hash_Ip6InBcastOctets && strcmp(name, "Ip6InBcastOctets") == 0)) ptr = &Ip6InBcastOctets;
+ else if(unlikely(hash == hash_Ip6OutBcastOctets && strcmp(name, "Ip6OutBcastOctets") == 0)) ptr = &Ip6OutBcastOctets;
+ else if(unlikely(hash == hash_Ip6InNoECTPkts && strcmp(name, "Ip6InNoECTPkts") == 0)) ptr = &Ip6InNoECTPkts;
+ else if(unlikely(hash == hash_Ip6InECT1Pkts && strcmp(name, "Ip6InECT1Pkts") == 0)) ptr = &Ip6InECT1Pkts;
+ else if(unlikely(hash == hash_Ip6InECT0Pkts && strcmp(name, "Ip6InECT0Pkts") == 0)) ptr = &Ip6InECT0Pkts;
+ else if(unlikely(hash == hash_Ip6InCEPkts && strcmp(name, "Ip6InCEPkts") == 0)) ptr = &Ip6InCEPkts;
+ else if(unlikely(hash == hash_Icmp6InMsgs && strcmp(name, "Icmp6InMsgs") == 0)) ptr = &Icmp6InMsgs;
+ else if(unlikely(hash == hash_Icmp6InErrors && strcmp(name, "Icmp6InErrors") == 0)) ptr = &Icmp6InErrors;
+ else if(unlikely(hash == hash_Icmp6OutMsgs && strcmp(name, "Icmp6OutMsgs") == 0)) ptr = &Icmp6OutMsgs;
+ else if(unlikely(hash == hash_Icmp6OutErrors && strcmp(name, "Icmp6OutErrors") == 0)) ptr = &Icmp6OutErrors;
+ else if(unlikely(hash == hash_Icmp6InCsumErrors && strcmp(name, "Icmp6InCsumErrors") == 0)) ptr = &Icmp6InCsumErrors;
+ else if(unlikely(hash == hash_Icmp6InDestUnreachs && strcmp(name, "Icmp6InDestUnreachs") == 0)) ptr = &Icmp6InDestUnreachs;
+ else if(unlikely(hash == hash_Icmp6InPktTooBigs && strcmp(name, "Icmp6InPktTooBigs") == 0)) ptr = &Icmp6InPktTooBigs;
+ else if(unlikely(hash == hash_Icmp6InTimeExcds && strcmp(name, "Icmp6InTimeExcds") == 0)) ptr = &Icmp6InTimeExcds;
+ else if(unlikely(hash == hash_Icmp6InParmProblems && strcmp(name, "Icmp6InParmProblems") == 0)) ptr = &Icmp6InParmProblems;
+ else if(unlikely(hash == hash_Icmp6InEchos && strcmp(name, "Icmp6InEchos") == 0)) ptr = &Icmp6InEchos;
+ else if(unlikely(hash == hash_Icmp6InEchoReplies && strcmp(name, "Icmp6InEchoReplies") == 0)) ptr = &Icmp6InEchoReplies;
+ else if(unlikely(hash == hash_Icmp6InGroupMembQueries && strcmp(name, "Icmp6InGroupMembQueries") == 0)) ptr = &Icmp6InGroupMembQueries;
+ else if(unlikely(hash == hash_Icmp6InGroupMembResponses && strcmp(name, "Icmp6InGroupMembResponses") == 0)) ptr = &Icmp6InGroupMembResponses;
+ else if(unlikely(hash == hash_Icmp6InGroupMembReductions && strcmp(name, "Icmp6InGroupMembReductions") == 0)) ptr = &Icmp6InGroupMembReductions;
+ else if(unlikely(hash == hash_Icmp6InRouterSolicits && strcmp(name, "Icmp6InRouterSolicits") == 0)) ptr = &Icmp6InRouterSolicits;
+ else if(unlikely(hash == hash_Icmp6InRouterAdvertisements && strcmp(name, "Icmp6InRouterAdvertisements") == 0)) ptr = &Icmp6InRouterAdvertisements;
+ else if(unlikely(hash == hash_Icmp6InNeighborSolicits && strcmp(name, "Icmp6InNeighborSolicits") == 0)) ptr = &Icmp6InNeighborSolicits;
+ else if(unlikely(hash == hash_Icmp6InNeighborAdvertisements && strcmp(name, "Icmp6InNeighborAdvertisements") == 0)) ptr = &Icmp6InNeighborAdvertisements;
+ else if(unlikely(hash == hash_Icmp6InRedirects && strcmp(name, "Icmp6InRedirects") == 0)) ptr = &Icmp6InRedirects;
+ else if(unlikely(hash == hash_Icmp6InMLDv2Reports && strcmp(name, "Icmp6InMLDv2Reports") == 0)) ptr = &Icmp6InMLDv2Reports;
+ else if(unlikely(hash == hash_Icmp6OutDestUnreachs && strcmp(name, "Icmp6OutDestUnreachs") == 0)) ptr = &Icmp6OutDestUnreachs;
+ else if(unlikely(hash == hash_Icmp6OutPktTooBigs && strcmp(name, "Icmp6OutPktTooBigs") == 0)) ptr = &Icmp6OutPktTooBigs;
+ else if(unlikely(hash == hash_Icmp6OutTimeExcds && strcmp(name, "Icmp6OutTimeExcds") == 0)) ptr = &Icmp6OutTimeExcds;
+ else if(unlikely(hash == hash_Icmp6OutParmProblems && strcmp(name, "Icmp6OutParmProblems") == 0)) ptr = &Icmp6OutParmProblems;
+ else if(unlikely(hash == hash_Icmp6OutEchos && strcmp(name, "Icmp6OutEchos") == 0)) ptr = &Icmp6OutEchos;
+ else if(unlikely(hash == hash_Icmp6OutEchoReplies && strcmp(name, "Icmp6OutEchoReplies") == 0)) ptr = &Icmp6OutEchoReplies;
+ else if(unlikely(hash == hash_Icmp6OutGroupMembQueries && strcmp(name, "Icmp6OutGroupMembQueries") == 0)) ptr = &Icmp6OutGroupMembQueries;
+ else if(unlikely(hash == hash_Icmp6OutGroupMembResponses && strcmp(name, "Icmp6OutGroupMembResponses") == 0)) ptr = &Icmp6OutGroupMembResponses;
+ else if(unlikely(hash == hash_Icmp6OutGroupMembReductions && strcmp(name, "Icmp6OutGroupMembReductions") == 0)) ptr = &Icmp6OutGroupMembReductions;
+ else if(unlikely(hash == hash_Icmp6OutRouterSolicits && strcmp(name, "Icmp6OutRouterSolicits") == 0)) ptr = &Icmp6OutRouterSolicits;
+ else if(unlikely(hash == hash_Icmp6OutRouterAdvertisements && strcmp(name, "Icmp6OutRouterAdvertisements") == 0)) ptr = &Icmp6OutRouterAdvertisements;
+ else if(unlikely(hash == hash_Icmp6OutNeighborSolicits && strcmp(name, "Icmp6OutNeighborSolicits") == 0)) ptr = &Icmp6OutNeighborSolicits;
+ else if(unlikely(hash == hash_Icmp6OutNeighborAdvertisements && strcmp(name, "Icmp6OutNeighborAdvertisements") == 0)) ptr = &Icmp6OutNeighborAdvertisements;
+ else if(unlikely(hash == hash_Icmp6OutRedirects && strcmp(name, "Icmp6OutRedirects") == 0)) ptr = &Icmp6OutRedirects;
+ else if(unlikely(hash == hash_Icmp6OutMLDv2Reports && strcmp(name, "Icmp6OutMLDv2Reports") == 0)) ptr = &Icmp6OutMLDv2Reports;
+ else if(unlikely(hash == hash_Icmp6InType1 && strcmp(name, "Icmp6InType1") == 0)) ptr = &Icmp6InType1;
+ else if(unlikely(hash == hash_Icmp6InType128 && strcmp(name, "Icmp6InType128") == 0)) ptr = &Icmp6InType128;
+ else if(unlikely(hash == hash_Icmp6InType129 && strcmp(name, "Icmp6InType129") == 0)) ptr = &Icmp6InType129;
+ else if(unlikely(hash == hash_Icmp6InType136 && strcmp(name, "Icmp6InType136") == 0)) ptr = &Icmp6InType136;
+ else if(unlikely(hash == hash_Icmp6OutType1 && strcmp(name, "Icmp6OutType1") == 0)) ptr = &Icmp6OutType1;
+ else if(unlikely(hash == hash_Icmp6OutType128 && strcmp(name, "Icmp6OutType128") == 0)) ptr = &Icmp6OutType128;
+ else if(unlikely(hash == hash_Icmp6OutType129 && strcmp(name, "Icmp6OutType129") == 0)) ptr = &Icmp6OutType129;
+ else if(unlikely(hash == hash_Icmp6OutType133 && strcmp(name, "Icmp6OutType133") == 0)) ptr = &Icmp6OutType133;
+ else if(unlikely(hash == hash_Icmp6OutType135 && strcmp(name, "Icmp6OutType135") == 0)) ptr = &Icmp6OutType135;
+ else if(unlikely(hash == hash_Icmp6OutType143 && strcmp(name, "Icmp6OutType143") == 0)) ptr = &Icmp6OutType143;
+ else if(unlikely(hash == hash_Udp6InDatagrams && strcmp(name, "Udp6InDatagrams") == 0)) ptr = &Udp6InDatagrams;
+ else if(unlikely(hash == hash_Udp6NoPorts && strcmp(name, "Udp6NoPorts") == 0)) ptr = &Udp6NoPorts;
+ else if(unlikely(hash == hash_Udp6InErrors && strcmp(name, "Udp6InErrors") == 0)) ptr = &Udp6InErrors;
+ else if(unlikely(hash == hash_Udp6OutDatagrams && strcmp(name, "Udp6OutDatagrams") == 0)) ptr = &Udp6OutDatagrams;
+ else if(unlikely(hash == hash_Udp6RcvbufErrors && strcmp(name, "Udp6RcvbufErrors") == 0)) ptr = &Udp6RcvbufErrors;
+ else if(unlikely(hash == hash_Udp6SndbufErrors && strcmp(name, "Udp6SndbufErrors") == 0)) ptr = &Udp6SndbufErrors;
+ else if(unlikely(hash == hash_Udp6InCsumErrors && strcmp(name, "Udp6InCsumErrors") == 0)) ptr = &Udp6InCsumErrors;
+ else if(unlikely(hash == hash_Udp6IgnoredMulti && strcmp(name, "Udp6IgnoredMulti") == 0)) ptr = &Udp6IgnoredMulti;
+ else if(unlikely(hash == hash_UdpLite6InDatagrams && strcmp(name, "UdpLite6InDatagrams") == 0)) ptr = &UdpLite6InDatagrams;
+ else if(unlikely(hash == hash_UdpLite6NoPorts && strcmp(name, "UdpLite6NoPorts") == 0)) ptr = &UdpLite6NoPorts;
+ else if(unlikely(hash == hash_UdpLite6InErrors && strcmp(name, "UdpLite6InErrors") == 0)) ptr = &UdpLite6InErrors;
+ else if(unlikely(hash == hash_UdpLite6OutDatagrams && strcmp(name, "UdpLite6OutDatagrams") == 0)) ptr = &UdpLite6OutDatagrams;
+ else if(unlikely(hash == hash_UdpLite6RcvbufErrors && strcmp(name, "UdpLite6RcvbufErrors") == 0)) ptr = &UdpLite6RcvbufErrors;
+ else if(unlikely(hash == hash_UdpLite6SndbufErrors && strcmp(name, "UdpLite6SndbufErrors") == 0)) ptr = &UdpLite6SndbufErrors;
+ else if(unlikely(hash == hash_UdpLite6InCsumErrors && strcmp(name, "UdpLite6InCsumErrors") == 0)) ptr = &UdpLite6InCsumErrors;
+
+ if(unlikely(ptr)) {
+ *ptr = str2ull(value);
+ ptr = NULL;
+ }
}
RRDSET *st;
for(w = 0; w < words ; w++) {
if(unlikely(softnet_column_name(w))) {
- uint32_t t = strtoul(procfile_lineword(ff, l, w), NULL, 16);
+ uint32_t t = (uint32_t)strtoul(procfile_lineword(ff, l, w), NULL, 16);
data[w] += t;
data[((l + 1) * allocated_columns) + w] = t;
}
mi = mallocz(sizeof(struct mountinfo));
unsigned long w = 0;
- mi->id = strtoul(procfile_lineword(ff, l, w), NULL, 10); w++;
- mi->parentid = strtoul(procfile_lineword(ff, l, w), NULL, 10); w++;
+ mi->id = str2ul(procfile_lineword(ff, l, w)); w++;
+ mi->parentid = str2ul(procfile_lineword(ff, l, w)); w++;
char *major = procfile_lineword(ff, l, w), *minor; w++;
for(minor = major; *minor && *minor != ':' ;minor++) ;
mi->flags = 0;
- mi->major = strtoul(major, NULL, 10);
- mi->minor = strtoul(minor, NULL, 10);
+ mi->major = str2ul(major);
+ mi->minor = str2ul(minor);
mi->root = strdupz(procfile_lineword(ff, l, w)); w++;
mi->root_hash = simple_hash(mi->root);
int c;
for(c = 0; c < cpus ;c++) {
if(likely((c + 1) < (int)words))
- irr->cpu[c].value = strtoull(procfile_lineword(ff, l, (uint32_t)(c + 1)), NULL, 10);
+ irr->cpu[c].value = str2ull(procfile_lineword(ff, l, (uint32_t)(c + 1)));
else
irr->cpu[c].value = 0;
unsigned long long user = 0, nice = 0, system = 0, idle = 0, iowait = 0, irq = 0, softirq = 0, steal = 0, guest = 0, guest_nice = 0;
id = row_key;
- user = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
- nice = strtoull(procfile_lineword(ff, l, 2), NULL, 10);
- system = strtoull(procfile_lineword(ff, l, 3), NULL, 10);
- idle = strtoull(procfile_lineword(ff, l, 4), NULL, 10);
- iowait = strtoull(procfile_lineword(ff, l, 5), NULL, 10);
- irq = strtoull(procfile_lineword(ff, l, 6), NULL, 10);
- softirq = strtoull(procfile_lineword(ff, l, 7), NULL, 10);
- steal = strtoull(procfile_lineword(ff, l, 8), NULL, 10);
-
- guest = strtoull(procfile_lineword(ff, l, 9), NULL, 10);
+ user = str2ull(procfile_lineword(ff, l, 1));
+ nice = str2ull(procfile_lineword(ff, l, 2));
+ system = str2ull(procfile_lineword(ff, l, 3));
+ idle = str2ull(procfile_lineword(ff, l, 4));
+ iowait = str2ull(procfile_lineword(ff, l, 5));
+ irq = str2ull(procfile_lineword(ff, l, 6));
+ softirq = str2ull(procfile_lineword(ff, l, 7));
+ steal = str2ull(procfile_lineword(ff, l, 8));
+
+ guest = str2ull(procfile_lineword(ff, l, 9));
user -= guest;
- guest_nice = strtoull(procfile_lineword(ff, l, 10), NULL, 10);
+ guest_nice = str2ull(procfile_lineword(ff, l, 10));
nice -= guest_nice;
char *title, *type, *context, *family;
}
}
else if(unlikely(hash == hash_intr && strcmp(row_key, "intr") == 0)) {
- unsigned long long value = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
+ unsigned long long value = str2ull(procfile_lineword(ff, l, 1));
// --------------------------------------------------------------------
}
}
else if(unlikely(hash == hash_ctxt && strcmp(row_key, "ctxt") == 0)) {
- unsigned long long value = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
+ unsigned long long value = str2ull(procfile_lineword(ff, l, 1));
// --------------------------------------------------------------------
}
}
else if(unlikely(hash == hash_processes && !processes && strcmp(row_key, "processes") == 0)) {
- processes = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
+ processes = str2ull(procfile_lineword(ff, l, 1));
}
else if(unlikely(hash == hash_procs_running && !running && strcmp(row_key, "procs_running") == 0)) {
- running = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
+ running = str2ull(procfile_lineword(ff, l, 1));
}
else if(unlikely(hash == hash_procs_blocked && !blocked && strcmp(row_key, "procs_blocked") == 0)) {
- blocked = strtoull(procfile_lineword(ff, l, 1), NULL, 10);
+ blocked = str2ull(procfile_lineword(ff, l, 1));
}
}
ff = procfile_readall(ff);
if(unlikely(!ff)) return 0; // we return 0, so that we will retry to open it next time
- unsigned long long entropy = strtoull(procfile_lineword(ff, 0, 0), NULL, 10);
+ unsigned long long entropy = str2ull(procfile_lineword(ff, 0, 0));
RRDSET *st = rrdset_find_bytype("system", "entropy");
if(unlikely(!st)) {
// unsigned long long workingset_refault = 0ULL;
// unsigned long long zone_reclaim_failed = 0ULL;
+ unsigned long long *ptr = NULL;
+
for(l = 0; l < lines ;l++) {
uint32_t words = procfile_linewords(ff, l);
if(unlikely(words < 2)) {
uint32_t hash = simple_hash(name);
if(unlikely(0)) ;
- // else if(unlikely(hash == hash_allocstall_dma32 && strcmp(name, "allocstall_dma32") == 0)) allocstall_dma32 = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_allocstall_dma && strcmp(name, "allocstall_dma") == 0)) allocstall_dma = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_allocstall_movable && strcmp(name, "allocstall_movable") == 0)) allocstall_movable = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_allocstall_normal && strcmp(name, "allocstall_normal") == 0)) allocstall_normal = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_balloon_deflate && strcmp(name, "balloon_deflate") == 0)) balloon_deflate = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_balloon_inflate && strcmp(name, "balloon_inflate") == 0)) balloon_inflate = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_balloon_migrate && strcmp(name, "balloon_migrate") == 0)) balloon_migrate = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_compact_daemon_wake && strcmp(name, "compact_daemon_wake") == 0)) compact_daemon_wake = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_compact_fail && strcmp(name, "compact_fail") == 0)) compact_fail = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_compact_free_scanned && strcmp(name, "compact_free_scanned") == 0)) compact_free_scanned = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_compact_isolated && strcmp(name, "compact_isolated") == 0)) compact_isolated = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_compact_migrate_scanned && strcmp(name, "compact_migrate_scanned") == 0)) compact_migrate_scanned = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_compact_stall && strcmp(name, "compact_stall") == 0)) compact_stall = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_compact_success && strcmp(name, "compact_success") == 0)) compact_success = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_drop_pagecache && strcmp(name, "drop_pagecache") == 0)) drop_pagecache = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_drop_slab && strcmp(name, "drop_slab") == 0)) drop_slab = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_htlb_buddy_alloc_fail && strcmp(name, "htlb_buddy_alloc_fail") == 0)) htlb_buddy_alloc_fail = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_htlb_buddy_alloc_success && strcmp(name, "htlb_buddy_alloc_success") == 0)) htlb_buddy_alloc_success = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_kswapd_high_wmark_hit_quickly && strcmp(name, "kswapd_high_wmark_hit_quickly") == 0)) kswapd_high_wmark_hit_quickly = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_kswapd_inodesteal && strcmp(name, "kswapd_inodesteal") == 0)) kswapd_inodesteal = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_kswapd_low_wmark_hit_quickly && strcmp(name, "kswapd_low_wmark_hit_quickly") == 0)) kswapd_low_wmark_hit_quickly = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_active_anon && strcmp(name, "nr_active_anon") == 0)) nr_active_anon = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_active_file && strcmp(name, "nr_active_file") == 0)) nr_active_file = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_anon_pages && strcmp(name, "nr_anon_pages") == 0)) nr_anon_pages = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_anon_transparent_hugepages && strcmp(name, "nr_anon_transparent_hugepages") == 0)) nr_anon_transparent_hugepages = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_bounce && strcmp(name, "nr_bounce") == 0)) nr_bounce = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_dirtied && strcmp(name, "nr_dirtied") == 0)) nr_dirtied = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_dirty_background_threshold && strcmp(name, "nr_dirty_background_threshold") == 0)) nr_dirty_background_threshold = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_dirty && strcmp(name, "nr_dirty") == 0)) nr_dirty = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_dirty_threshold && strcmp(name, "nr_dirty_threshold") == 0)) nr_dirty_threshold = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_file_pages && strcmp(name, "nr_file_pages") == 0)) nr_file_pages = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_free_cma && strcmp(name, "nr_free_cma") == 0)) nr_free_cma = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_free_pages && strcmp(name, "nr_free_pages") == 0)) nr_free_pages = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_inactive_anon && strcmp(name, "nr_inactive_anon") == 0)) nr_inactive_anon = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_inactive_file && strcmp(name, "nr_inactive_file") == 0)) nr_inactive_file = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_isolated_anon && strcmp(name, "nr_isolated_anon") == 0)) nr_isolated_anon = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_isolated_file && strcmp(name, "nr_isolated_file") == 0)) nr_isolated_file = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_kernel_stack && strcmp(name, "nr_kernel_stack") == 0)) nr_kernel_stack = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_mapped && strcmp(name, "nr_mapped") == 0)) nr_mapped = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_mlock && strcmp(name, "nr_mlock") == 0)) nr_mlock = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_pages_scanned && strcmp(name, "nr_pages_scanned") == 0)) nr_pages_scanned = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_page_table_pages && strcmp(name, "nr_page_table_pages") == 0)) nr_page_table_pages = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_shmem_hugepages && strcmp(name, "nr_shmem_hugepages") == 0)) nr_shmem_hugepages = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_shmem_pmdmapped && strcmp(name, "nr_shmem_pmdmapped") == 0)) nr_shmem_pmdmapped = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_shmem && strcmp(name, "nr_shmem") == 0)) nr_shmem = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_slab_reclaimable && strcmp(name, "nr_slab_reclaimable") == 0)) nr_slab_reclaimable = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_slab_unreclaimable && strcmp(name, "nr_slab_unreclaimable") == 0)) nr_slab_unreclaimable = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_unevictable && strcmp(name, "nr_unevictable") == 0)) nr_unevictable = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_unstable && strcmp(name, "nr_unstable") == 0)) nr_unstable = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_vmscan_immediate_reclaim && strcmp(name, "nr_vmscan_immediate_reclaim") == 0)) nr_vmscan_immediate_reclaim = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_vmscan_write && strcmp(name, "nr_vmscan_write") == 0)) nr_vmscan_write = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_writeback && strcmp(name, "nr_writeback") == 0)) nr_writeback = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_writeback_temp && strcmp(name, "nr_writeback_temp") == 0)) nr_writeback_temp = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_written && strcmp(name, "nr_written") == 0)) nr_written = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_zone_active_anon && strcmp(name, "nr_zone_active_anon") == 0)) nr_zone_active_anon = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_zone_active_file && strcmp(name, "nr_zone_active_file") == 0)) nr_zone_active_file = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_zone_inactive_anon && strcmp(name, "nr_zone_inactive_anon") == 0)) nr_zone_inactive_anon = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_zone_inactive_file && strcmp(name, "nr_zone_inactive_file") == 0)) nr_zone_inactive_file = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_zone_unevictable && strcmp(name, "nr_zone_unevictable") == 0)) nr_zone_unevictable = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_zone_write_pending && strcmp(name, "nr_zone_write_pending") == 0)) nr_zone_write_pending = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_nr_zspages && strcmp(name, "nr_zspages") == 0)) nr_zspages = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_numa_foreign && strcmp(name, "numa_foreign") == 0)) numa_foreign = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_numa_hint_faults_local && strcmp(name, "numa_hint_faults_local") == 0)) numa_hint_faults_local = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_numa_hint_faults && strcmp(name, "numa_hint_faults") == 0)) numa_hint_faults = strtoull(value, NULL, 10);
- //else if(unlikely(hash == hash_numa_hit && strcmp(name, "numa_hit") == 0)) numa_hit = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_numa_huge_pte_updates && strcmp(name, "numa_huge_pte_updates") == 0)) numa_huge_pte_updates = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_numa_interleave && strcmp(name, "numa_interleave") == 0)) numa_interleave = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_numa_local && strcmp(name, "numa_local") == 0)) numa_local = strtoull(value, NULL, 10);
- //else if(unlikely(hash == hash_numa_miss && strcmp(name, "numa_miss") == 0)) numa_miss = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_numa_other && strcmp(name, "numa_other") == 0)) numa_other = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_numa_pages_migrated && strcmp(name, "numa_pages_migrated") == 0)) numa_pages_migrated = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_numa_pte_updates && strcmp(name, "numa_pte_updates") == 0)) numa_pte_updates = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_pageoutrun && strcmp(name, "pageoutrun") == 0)) pageoutrun = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_pgactivate && strcmp(name, "pgactivate") == 0)) pgactivate = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_pgalloc_dma32 && strcmp(name, "pgalloc_dma32") == 0)) pgalloc_dma32 = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_pgalloc_dma && strcmp(name, "pgalloc_dma") == 0)) pgalloc_dma = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_pgalloc_movable && strcmp(name, "pgalloc_movable") == 0)) pgalloc_movable = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_pgalloc_normal && strcmp(name, "pgalloc_normal") == 0)) pgalloc_normal = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_pgdeactivate && strcmp(name, "pgdeactivate") == 0)) pgdeactivate = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_pgfault && strcmp(name, "pgfault") == 0)) pgfault = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_pgfree && strcmp(name, "pgfree") == 0)) pgfree = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_pginodesteal && strcmp(name, "pginodesteal") == 0)) pginodesteal = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_pglazyfreed && strcmp(name, "pglazyfreed") == 0)) pglazyfreed = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_pgmajfault && strcmp(name, "pgmajfault") == 0)) pgmajfault = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_pgmigrate_fail && strcmp(name, "pgmigrate_fail") == 0)) pgmigrate_fail = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_pgmigrate_success && strcmp(name, "pgmigrate_success") == 0)) pgmigrate_success = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_pgpgin && strcmp(name, "pgpgin") == 0)) pgpgin = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_pgpgout && strcmp(name, "pgpgout") == 0)) pgpgout = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_pgrefill && strcmp(name, "pgrefill") == 0)) pgrefill = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_pgrotated && strcmp(name, "pgrotated") == 0)) pgrotated = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_pgscan_direct && strcmp(name, "pgscan_direct") == 0)) pgscan_direct = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_pgscan_direct_throttle && strcmp(name, "pgscan_direct_throttle") == 0)) pgscan_direct_throttle = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_pgscan_kswapd && strcmp(name, "pgscan_kswapd") == 0)) pgscan_kswapd = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_pgskip_dma32 && strcmp(name, "pgskip_dma32") == 0)) pgskip_dma32 = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_pgskip_dma && strcmp(name, "pgskip_dma") == 0)) pgskip_dma = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_pgskip_movable && strcmp(name, "pgskip_movable") == 0)) pgskip_movable = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_pgskip_normal && strcmp(name, "pgskip_normal") == 0)) pgskip_normal = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_pgsteal_direct && strcmp(name, "pgsteal_direct") == 0)) pgsteal_direct = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_pgsteal_kswapd && strcmp(name, "pgsteal_kswapd") == 0)) pgsteal_kswapd = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_pswpin && strcmp(name, "pswpin") == 0)) pswpin = strtoull(value, NULL, 10);
- else if(unlikely(hash == hash_pswpout && strcmp(name, "pswpout") == 0)) pswpout = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_slabs_scanned && strcmp(name, "slabs_scanned") == 0)) slabs_scanned = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_thp_collapse_alloc_failed && strcmp(name, "thp_collapse_alloc_failed") == 0)) thp_collapse_alloc_failed = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_thp_collapse_alloc && strcmp(name, "thp_collapse_alloc") == 0)) thp_collapse_alloc = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_thp_deferred_split_page && strcmp(name, "thp_deferred_split_page") == 0)) thp_deferred_split_page = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_thp_fault_alloc && strcmp(name, "thp_fault_alloc") == 0)) thp_fault_alloc = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_thp_fault_fallback && strcmp(name, "thp_fault_fallback") == 0)) thp_fault_fallback = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_thp_file_alloc && strcmp(name, "thp_file_alloc") == 0)) thp_file_alloc = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_thp_file_mapped && strcmp(name, "thp_file_mapped") == 0)) thp_file_mapped = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_thp_split_page_failed && strcmp(name, "thp_split_page_failed") == 0)) thp_split_page_failed = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_thp_split_page && strcmp(name, "thp_split_page") == 0)) thp_split_page = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_thp_split_pmd && strcmp(name, "thp_split_pmd") == 0)) thp_split_pmd = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_thp_zero_page_alloc_failed && strcmp(name, "thp_zero_page_alloc_failed") == 0)) thp_zero_page_alloc_failed = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_thp_zero_page_alloc && strcmp(name, "thp_zero_page_alloc") == 0)) thp_zero_page_alloc = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_unevictable_pgs_cleared && strcmp(name, "unevictable_pgs_cleared") == 0)) unevictable_pgs_cleared = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_unevictable_pgs_culled && strcmp(name, "unevictable_pgs_culled") == 0)) unevictable_pgs_culled = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_unevictable_pgs_mlocked && strcmp(name, "unevictable_pgs_mlocked") == 0)) unevictable_pgs_mlocked = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_unevictable_pgs_munlocked && strcmp(name, "unevictable_pgs_munlocked") == 0)) unevictable_pgs_munlocked = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_unevictable_pgs_rescued && strcmp(name, "unevictable_pgs_rescued") == 0)) unevictable_pgs_rescued = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_unevictable_pgs_scanned && strcmp(name, "unevictable_pgs_scanned") == 0)) unevictable_pgs_scanned = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_unevictable_pgs_stranded && strcmp(name, "unevictable_pgs_stranded") == 0)) unevictable_pgs_stranded = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_workingset_activate && strcmp(name, "workingset_activate") == 0)) workingset_activate = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_workingset_nodereclaim && strcmp(name, "workingset_nodereclaim") == 0)) workingset_nodereclaim = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_workingset_refault && strcmp(name, "workingset_refault") == 0)) workingset_refault = strtoull(value, NULL, 10);
- // else if(unlikely(hash == hash_zone_reclaim_failed && strcmp(name, "zone_reclaim_failed") == 0)) zone_reclaim_failed = strtoull(value, NULL, 10);
+ // else if(unlikely(hash == hash_allocstall_dma32 && strcmp(name, "allocstall_dma32") == 0)) ptr = &allocstall_dma32;
+ // else if(unlikely(hash == hash_allocstall_dma && strcmp(name, "allocstall_dma") == 0)) ptr = &allocstall_dma;
+ // else if(unlikely(hash == hash_allocstall_movable && strcmp(name, "allocstall_movable") == 0)) ptr = &allocstall_movable;
+ // else if(unlikely(hash == hash_allocstall_normal && strcmp(name, "allocstall_normal") == 0)) ptr = &allocstall_normal;
+ // else if(unlikely(hash == hash_balloon_deflate && strcmp(name, "balloon_deflate") == 0)) ptr = &balloon_deflate;
+ // else if(unlikely(hash == hash_balloon_inflate && strcmp(name, "balloon_inflate") == 0)) ptr = &balloon_inflate;
+ // else if(unlikely(hash == hash_balloon_migrate && strcmp(name, "balloon_migrate") == 0)) ptr = &balloon_migrate;
+ // else if(unlikely(hash == hash_compact_daemon_wake && strcmp(name, "compact_daemon_wake") == 0)) ptr = &compact_daemon_wake;
+ // else if(unlikely(hash == hash_compact_fail && strcmp(name, "compact_fail") == 0)) ptr = &compact_fail;
+ // else if(unlikely(hash == hash_compact_free_scanned && strcmp(name, "compact_free_scanned") == 0)) ptr = &compact_free_scanned;
+ // else if(unlikely(hash == hash_compact_isolated && strcmp(name, "compact_isolated") == 0)) ptr = &compact_isolated;
+ // else if(unlikely(hash == hash_compact_migrate_scanned && strcmp(name, "compact_migrate_scanned") == 0)) ptr = &compact_migrate_scanned;
+ // else if(unlikely(hash == hash_compact_stall && strcmp(name, "compact_stall") == 0)) ptr = &compact_stall;
+ // else if(unlikely(hash == hash_compact_success && strcmp(name, "compact_success") == 0)) ptr = &compact_success;
+ // else if(unlikely(hash == hash_drop_pagecache && strcmp(name, "drop_pagecache") == 0)) ptr = &drop_pagecache;
+ // else if(unlikely(hash == hash_drop_slab && strcmp(name, "drop_slab") == 0)) ptr = &drop_slab;
+ // else if(unlikely(hash == hash_htlb_buddy_alloc_fail && strcmp(name, "htlb_buddy_alloc_fail") == 0)) ptr = &htlb_buddy_alloc_fail;
+ // else if(unlikely(hash == hash_htlb_buddy_alloc_success && strcmp(name, "htlb_buddy_alloc_success") == 0)) ptr = &htlb_buddy_alloc_success;
+ // else if(unlikely(hash == hash_kswapd_high_wmark_hit_quickly && strcmp(name, "kswapd_high_wmark_hit_quickly") == 0)) ptr = &kswapd_high_wmark_hit_quickly;
+ // else if(unlikely(hash == hash_kswapd_inodesteal && strcmp(name, "kswapd_inodesteal") == 0)) ptr = &kswapd_inodesteal;
+ // else if(unlikely(hash == hash_kswapd_low_wmark_hit_quickly && strcmp(name, "kswapd_low_wmark_hit_quickly") == 0)) ptr = &kswapd_low_wmark_hit_quickly;
+ // else if(unlikely(hash == hash_nr_active_anon && strcmp(name, "nr_active_anon") == 0)) ptr = &nr_active_anon;
+ // else if(unlikely(hash == hash_nr_active_file && strcmp(name, "nr_active_file") == 0)) ptr = &nr_active_file;
+ // else if(unlikely(hash == hash_nr_anon_pages && strcmp(name, "nr_anon_pages") == 0)) ptr = &nr_anon_pages;
+ // else if(unlikely(hash == hash_nr_anon_transparent_hugepages && strcmp(name, "nr_anon_transparent_hugepages") == 0)) ptr = &nr_anon_transparent_hugepages;
+ // else if(unlikely(hash == hash_nr_bounce && strcmp(name, "nr_bounce") == 0)) ptr = &nr_bounce;
+ // else if(unlikely(hash == hash_nr_dirtied && strcmp(name, "nr_dirtied") == 0)) ptr = &nr_dirtied;
+ // else if(unlikely(hash == hash_nr_dirty_background_threshold && strcmp(name, "nr_dirty_background_threshold") == 0)) ptr = &nr_dirty_background_threshold;
+ // else if(unlikely(hash == hash_nr_dirty && strcmp(name, "nr_dirty") == 0)) ptr = &nr_dirty;
+ // else if(unlikely(hash == hash_nr_dirty_threshold && strcmp(name, "nr_dirty_threshold") == 0)) ptr = &nr_dirty_threshold;
+ // else if(unlikely(hash == hash_nr_file_pages && strcmp(name, "nr_file_pages") == 0)) ptr = &nr_file_pages;
+ // else if(unlikely(hash == hash_nr_free_cma && strcmp(name, "nr_free_cma") == 0)) ptr = &nr_free_cma;
+ // else if(unlikely(hash == hash_nr_free_pages && strcmp(name, "nr_free_pages") == 0)) ptr = &nr_free_pages;
+ // else if(unlikely(hash == hash_nr_inactive_anon && strcmp(name, "nr_inactive_anon") == 0)) ptr = &nr_inactive_anon;
+ // else if(unlikely(hash == hash_nr_inactive_file && strcmp(name, "nr_inactive_file") == 0)) ptr = &nr_inactive_file;
+ // else if(unlikely(hash == hash_nr_isolated_anon && strcmp(name, "nr_isolated_anon") == 0)) ptr = &nr_isolated_anon;
+ // else if(unlikely(hash == hash_nr_isolated_file && strcmp(name, "nr_isolated_file") == 0)) ptr = &nr_isolated_file;
+ // else if(unlikely(hash == hash_nr_kernel_stack && strcmp(name, "nr_kernel_stack") == 0)) ptr = &nr_kernel_stack;
+ // else if(unlikely(hash == hash_nr_mapped && strcmp(name, "nr_mapped") == 0)) ptr = &nr_mapped;
+ // else if(unlikely(hash == hash_nr_mlock && strcmp(name, "nr_mlock") == 0)) ptr = &nr_mlock;
+ // else if(unlikely(hash == hash_nr_pages_scanned && strcmp(name, "nr_pages_scanned") == 0)) ptr = &nr_pages_scanned;
+ // else if(unlikely(hash == hash_nr_page_table_pages && strcmp(name, "nr_page_table_pages") == 0)) ptr = &nr_page_table_pages;
+ // else if(unlikely(hash == hash_nr_shmem_hugepages && strcmp(name, "nr_shmem_hugepages") == 0)) ptr = &nr_shmem_hugepages;
+ // else if(unlikely(hash == hash_nr_shmem_pmdmapped && strcmp(name, "nr_shmem_pmdmapped") == 0)) ptr = &nr_shmem_pmdmapped;
+ // else if(unlikely(hash == hash_nr_shmem && strcmp(name, "nr_shmem") == 0)) ptr = &nr_shmem;
+ // else if(unlikely(hash == hash_nr_slab_reclaimable && strcmp(name, "nr_slab_reclaimable") == 0)) ptr = &nr_slab_reclaimable;
+ // else if(unlikely(hash == hash_nr_slab_unreclaimable && strcmp(name, "nr_slab_unreclaimable") == 0)) ptr = &nr_slab_unreclaimable;
+ // else if(unlikely(hash == hash_nr_unevictable && strcmp(name, "nr_unevictable") == 0)) ptr = &nr_unevictable;
+ // else if(unlikely(hash == hash_nr_unstable && strcmp(name, "nr_unstable") == 0)) ptr = &nr_unstable;
+ // else if(unlikely(hash == hash_nr_vmscan_immediate_reclaim && strcmp(name, "nr_vmscan_immediate_reclaim") == 0)) ptr = &nr_vmscan_immediate_reclaim;
+ // else if(unlikely(hash == hash_nr_vmscan_write && strcmp(name, "nr_vmscan_write") == 0)) ptr = &nr_vmscan_write;
+ // else if(unlikely(hash == hash_nr_writeback && strcmp(name, "nr_writeback") == 0)) ptr = &nr_writeback;
+ // else if(unlikely(hash == hash_nr_writeback_temp && strcmp(name, "nr_writeback_temp") == 0)) ptr = &nr_writeback_temp;
+ // else if(unlikely(hash == hash_nr_written && strcmp(name, "nr_written") == 0)) ptr = &nr_written;
+ // else if(unlikely(hash == hash_nr_zone_active_anon && strcmp(name, "nr_zone_active_anon") == 0)) ptr = &nr_zone_active_anon;
+ // else if(unlikely(hash == hash_nr_zone_active_file && strcmp(name, "nr_zone_active_file") == 0)) ptr = &nr_zone_active_file;
+ // else if(unlikely(hash == hash_nr_zone_inactive_anon && strcmp(name, "nr_zone_inactive_anon") == 0)) ptr = &nr_zone_inactive_anon;
+ // else if(unlikely(hash == hash_nr_zone_inactive_file && strcmp(name, "nr_zone_inactive_file") == 0)) ptr = &nr_zone_inactive_file;
+ // else if(unlikely(hash == hash_nr_zone_unevictable && strcmp(name, "nr_zone_unevictable") == 0)) ptr = &nr_zone_unevictable;
+ // else if(unlikely(hash == hash_nr_zone_write_pending && strcmp(name, "nr_zone_write_pending") == 0)) ptr = &nr_zone_write_pending;
+ // else if(unlikely(hash == hash_nr_zspages && strcmp(name, "nr_zspages") == 0)) ptr = &nr_zspages;
+ else if(unlikely(hash == hash_numa_foreign && strcmp(name, "numa_foreign") == 0)) ptr = &numa_foreign;
+ else if(unlikely(hash == hash_numa_hint_faults_local && strcmp(name, "numa_hint_faults_local") == 0)) ptr = &numa_hint_faults_local;
+ else if(unlikely(hash == hash_numa_hint_faults && strcmp(name, "numa_hint_faults") == 0)) ptr = &numa_hint_faults;
+ //else if(unlikely(hash == hash_numa_hit && strcmp(name, "numa_hit") == 0)) ptr = &numa_hit;
+ else if(unlikely(hash == hash_numa_huge_pte_updates && strcmp(name, "numa_huge_pte_updates") == 0)) ptr = &numa_huge_pte_updates;
+ else if(unlikely(hash == hash_numa_interleave && strcmp(name, "numa_interleave") == 0)) ptr = &numa_interleave;
+ else if(unlikely(hash == hash_numa_local && strcmp(name, "numa_local") == 0)) ptr = &numa_local;
+ //else if(unlikely(hash == hash_numa_miss && strcmp(name, "numa_miss") == 0)) ptr = &numa_miss;
+ else if(unlikely(hash == hash_numa_other && strcmp(name, "numa_other") == 0)) ptr = &numa_other;
+ else if(unlikely(hash == hash_numa_pages_migrated && strcmp(name, "numa_pages_migrated") == 0)) ptr = &numa_pages_migrated;
+ else if(unlikely(hash == hash_numa_pte_updates && strcmp(name, "numa_pte_updates") == 0)) ptr = &numa_pte_updates;
+ // else if(unlikely(hash == hash_pageoutrun && strcmp(name, "pageoutrun") == 0)) ptr = &pageoutrun;
+ // else if(unlikely(hash == hash_pgactivate && strcmp(name, "pgactivate") == 0)) ptr = &pgactivate;
+ // else if(unlikely(hash == hash_pgalloc_dma32 && strcmp(name, "pgalloc_dma32") == 0)) ptr = &pgalloc_dma32;
+ // else if(unlikely(hash == hash_pgalloc_dma && strcmp(name, "pgalloc_dma") == 0)) ptr = &pgalloc_dma;
+ // else if(unlikely(hash == hash_pgalloc_movable && strcmp(name, "pgalloc_movable") == 0)) ptr = &pgalloc_movable;
+ // else if(unlikely(hash == hash_pgalloc_normal && strcmp(name, "pgalloc_normal") == 0)) ptr = &pgalloc_normal;
+ // else if(unlikely(hash == hash_pgdeactivate && strcmp(name, "pgdeactivate") == 0)) ptr = &pgdeactivate;
+ else if(unlikely(hash == hash_pgfault && strcmp(name, "pgfault") == 0)) ptr = &pgfault;
+ // else if(unlikely(hash == hash_pgfree && strcmp(name, "pgfree") == 0)) ptr = &pgfree;
+ // else if(unlikely(hash == hash_pginodesteal && strcmp(name, "pginodesteal") == 0)) ptr = &pginodesteal;
+ // else if(unlikely(hash == hash_pglazyfreed && strcmp(name, "pglazyfreed") == 0)) ptr = &pglazyfreed;
+ else if(unlikely(hash == hash_pgmajfault && strcmp(name, "pgmajfault") == 0)) ptr = &pgmajfault;
+ // else if(unlikely(hash == hash_pgmigrate_fail && strcmp(name, "pgmigrate_fail") == 0)) ptr = &pgmigrate_fail;
+ // else if(unlikely(hash == hash_pgmigrate_success && strcmp(name, "pgmigrate_success") == 0)) ptr = &pgmigrate_success;
+ else if(unlikely(hash == hash_pgpgin && strcmp(name, "pgpgin") == 0)) ptr = &pgpgin;
+ else if(unlikely(hash == hash_pgpgout && strcmp(name, "pgpgout") == 0)) ptr = &pgpgout;
+ // else if(unlikely(hash == hash_pgrefill && strcmp(name, "pgrefill") == 0)) ptr = &pgrefill;
+ // else if(unlikely(hash == hash_pgrotated && strcmp(name, "pgrotated") == 0)) ptr = &pgrotated;
+ // else if(unlikely(hash == hash_pgscan_direct && strcmp(name, "pgscan_direct") == 0)) ptr = &pgscan_direct;
+ // else if(unlikely(hash == hash_pgscan_direct_throttle && strcmp(name, "pgscan_direct_throttle") == 0)) ptr = &pgscan_direct_throttle;
+ // else if(unlikely(hash == hash_pgscan_kswapd && strcmp(name, "pgscan_kswapd") == 0)) ptr = &pgscan_kswapd;
+ // else if(unlikely(hash == hash_pgskip_dma32 && strcmp(name, "pgskip_dma32") == 0)) ptr = &pgskip_dma32;
+ // else if(unlikely(hash == hash_pgskip_dma && strcmp(name, "pgskip_dma") == 0)) ptr = &pgskip_dma;
+ // else if(unlikely(hash == hash_pgskip_movable && strcmp(name, "pgskip_movable") == 0)) ptr = &pgskip_movable;
+ // else if(unlikely(hash == hash_pgskip_normal && strcmp(name, "pgskip_normal") == 0)) ptr = &pgskip_normal;
+ // else if(unlikely(hash == hash_pgsteal_direct && strcmp(name, "pgsteal_direct") == 0)) ptr = &pgsteal_direct;
+ // else if(unlikely(hash == hash_pgsteal_kswapd && strcmp(name, "pgsteal_kswapd") == 0)) ptr = &pgsteal_kswapd;
+ else if(unlikely(hash == hash_pswpin && strcmp(name, "pswpin") == 0)) ptr = &pswpin;
+ else if(unlikely(hash == hash_pswpout && strcmp(name, "pswpout") == 0)) ptr = &pswpout;
+ // else if(unlikely(hash == hash_slabs_scanned && strcmp(name, "slabs_scanned") == 0)) ptr = &slabs_scanned;
+ // else if(unlikely(hash == hash_thp_collapse_alloc_failed && strcmp(name, "thp_collapse_alloc_failed") == 0)) ptr = &thp_collapse_alloc_failed;
+ // else if(unlikely(hash == hash_thp_collapse_alloc && strcmp(name, "thp_collapse_alloc") == 0)) ptr = &thp_collapse_alloc;
+ // else if(unlikely(hash == hash_thp_deferred_split_page && strcmp(name, "thp_deferred_split_page") == 0)) ptr = &thp_deferred_split_page;
+ // else if(unlikely(hash == hash_thp_fault_alloc && strcmp(name, "thp_fault_alloc") == 0)) ptr = &thp_fault_alloc;
+ // else if(unlikely(hash == hash_thp_fault_fallback && strcmp(name, "thp_fault_fallback") == 0)) ptr = &thp_fault_fallback;
+ // else if(unlikely(hash == hash_thp_file_alloc && strcmp(name, "thp_file_alloc") == 0)) ptr = &thp_file_alloc;
+ // else if(unlikely(hash == hash_thp_file_mapped && strcmp(name, "thp_file_mapped") == 0)) ptr = &thp_file_mapped;
+ // else if(unlikely(hash == hash_thp_split_page_failed && strcmp(name, "thp_split_page_failed") == 0)) ptr = &thp_split_page_failed;
+ // else if(unlikely(hash == hash_thp_split_page && strcmp(name, "thp_split_page") == 0)) ptr = &thp_split_page;
+ // else if(unlikely(hash == hash_thp_split_pmd && strcmp(name, "thp_split_pmd") == 0)) ptr = &thp_split_pmd;
+ // else if(unlikely(hash == hash_thp_zero_page_alloc_failed && strcmp(name, "thp_zero_page_alloc_failed") == 0)) ptr = &thp_zero_page_alloc_failed;
+ // else if(unlikely(hash == hash_thp_zero_page_alloc && strcmp(name, "thp_zero_page_alloc") == 0)) ptr = &thp_zero_page_alloc;
+ // else if(unlikely(hash == hash_unevictable_pgs_cleared && strcmp(name, "unevictable_pgs_cleared") == 0)) ptr = &unevictable_pgs_cleared;
+ // else if(unlikely(hash == hash_unevictable_pgs_culled && strcmp(name, "unevictable_pgs_culled") == 0)) ptr = &unevictable_pgs_culled;
+ // else if(unlikely(hash == hash_unevictable_pgs_mlocked && strcmp(name, "unevictable_pgs_mlocked") == 0)) ptr = &unevictable_pgs_mlocked;
+ // else if(unlikely(hash == hash_unevictable_pgs_munlocked && strcmp(name, "unevictable_pgs_munlocked") == 0)) ptr = &unevictable_pgs_munlocked;
+ // else if(unlikely(hash == hash_unevictable_pgs_rescued && strcmp(name, "unevictable_pgs_rescued") == 0)) ptr = &unevictable_pgs_rescued;
+ // else if(unlikely(hash == hash_unevictable_pgs_scanned && strcmp(name, "unevictable_pgs_scanned") == 0)) ptr = &unevictable_pgs_scanned;
+ // else if(unlikely(hash == hash_unevictable_pgs_stranded && strcmp(name, "unevictable_pgs_stranded") == 0)) ptr = &unevictable_pgs_stranded;
+ // else if(unlikely(hash == hash_workingset_activate && strcmp(name, "workingset_activate") == 0)) ptr = &workingset_activate;
+ // else if(unlikely(hash == hash_workingset_nodereclaim && strcmp(name, "workingset_nodereclaim") == 0)) ptr = &workingset_nodereclaim;
+ // else if(unlikely(hash == hash_workingset_refault && strcmp(name, "workingset_refault") == 0)) ptr = &workingset_refault;
+ // else if(unlikely(hash == hash_zone_reclaim_failed && strcmp(name, "zone_reclaim_failed") == 0)) ptr = &zone_reclaim_failed;
+
+ if(unlikely(ptr)) {
+ *ptr = str2ull(value);
+ ptr = NULL;
+ }
}
// --------------------------------------------------------------------
if(unlikely(!m->ce_ff || procfile_lines(m->ce_ff) < 1 || procfile_linewords(m->ce_ff, 0) < 1))
continue;
- m->ce_count = strtoull(procfile_lineword(m->ce_ff, 0, 0), NULL, 0);
+ m->ce_count = str2ull(procfile_lineword(m->ce_ff, 0, 0));
ce_sum += m->ce_count;
m->ce_updated = 1;
}
if(unlikely(!m->ue_ff || procfile_lines(m->ue_ff) < 1 || procfile_linewords(m->ue_ff, 0) < 1))
continue;
- m->ue_count = strtoull(procfile_lineword(m->ue_ff, 0, 0), NULL, 0);
+ m->ue_count = str2ull(procfile_lineword(m->ue_ff, 0, 0));
ue_sum += m->ue_count;
m->ue_updated = 1;
}
ff_pages_shared = procfile_readall(ff_pages_shared);
if(!ff_pages_shared) return 0; // we return 0, so that we will retry to open it next time
- pages_shared = strtoull(procfile_lineword(ff_pages_shared, 0, 0), NULL, 10);
+ pages_shared = str2ull(procfile_lineword(ff_pages_shared, 0, 0));
ff_pages_sharing = procfile_readall(ff_pages_sharing);
if(!ff_pages_sharing) return 0; // we return 0, so that we will retry to open it next time
- pages_sharing = strtoull(procfile_lineword(ff_pages_sharing, 0, 0), NULL, 10);
+ pages_sharing = str2ull(procfile_lineword(ff_pages_sharing, 0, 0));
ff_pages_unshared = procfile_readall(ff_pages_unshared);
if(!ff_pages_unshared) return 0; // we return 0, so that we will retry to open it next time
- pages_unshared = strtoull(procfile_lineword(ff_pages_unshared, 0, 0), NULL, 10);
+ pages_unshared = str2ull(procfile_lineword(ff_pages_unshared, 0, 0));
ff_pages_volatile = procfile_readall(ff_pages_volatile);
if(!ff_pages_volatile) return 0; // we return 0, so that we will retry to open it next time
- pages_volatile = strtoull(procfile_lineword(ff_pages_volatile, 0, 0), NULL, 10);
+ pages_volatile = str2ull(procfile_lineword(ff_pages_volatile, 0, 0));
ff_pages_to_scan = procfile_readall(ff_pages_to_scan);
if(!ff_pages_to_scan) return 0; // we return 0, so that we will retry to open it next time
- pages_to_scan = strtoull(procfile_lineword(ff_pages_to_scan, 0, 0), NULL, 10);
+ pages_to_scan = str2ull(procfile_lineword(ff_pages_to_scan, 0, 0));
offered = pages_sharing + pages_shared + pages_unshared + pages_volatile;
saved = pages_sharing - pages_shared;
if(dcdiff < 0) dcdiff = -dcdiff;
size_t len = print_calculated_number(buffer, d);
- calculated_number p = strtold(buffer, NULL);
+ calculated_number p = str2l(buffer);
calculated_number pdiff = n - p;
calculated_number pcdiff = pdiff * 100.0 / n;
if(pcdiff < 0) pcdiff = -pcdiff;
break;
}
else {
- calculated_number v = strtold(value_buffer, NULL);
+ calculated_number v = str2l(value_buffer);
if(comparison == '<' && value < v) break;
else if(comparison == '(' && value <= v) break;
}
}
- long long multiply = (multiply_str && *multiply_str )?atol(multiply_str):1;
- long long divide = (divide_str && *divide_str )?atol(divide_str):1;
- long long before = (before_str && *before_str )?atol(before_str):0;
- long long after = (after_str && *after_str )?atol(after_str):-st->update_every;
- int points = (points_str && *points_str )?atoi(points_str):1;
- int precision = (precision_str && *precision_str)?atoi(precision_str):-1;
+ long long multiply = (multiply_str && *multiply_str )?str2l(multiply_str):1;
+ long long divide = (divide_str && *divide_str )?str2l(divide_str):1;
+ long long before = (before_str && *before_str )?str2l(before_str):0;
+ long long after = (after_str && *after_str )?str2l(after_str):-st->update_every;
+ int points = (points_str && *points_str )?str2i(points_str):1;
+ int precision = (precision_str && *precision_str)?str2i(precision_str):-1;
if(!multiply) multiply = 1;
if(!divide) divide = 1;
}
}
else {
- refresh = atoi(refresh_str);
+ refresh = str2i(refresh_str);
if(refresh < 0) refresh = -refresh;
}
}
goto cleanup;
}
- long long before = (before_str && *before_str)?atol(before_str):0;
- long long after = (after_str && *after_str) ?atol(after_str):0;
- int points = (points_str && *points_str)?atoi(points_str):0;
+ long long before = (before_str && *before_str)?str2l(before_str):0;
+ long long after = (after_str && *after_str) ?str2l(after_str):0;
+ int points = (points_str && *points_str)?str2i(points_str):0;
debug(D_WEB_CLIENT, "%llu: API command 'data' for chart '%s', dimensions '%s', after '%lld', before '%lld', points '%d', group '%d', format '%u', options '0x%08x'"
, w->id
if(url) {
// parse the lines required
tok = mystrsep(&url, "/");
- if(tok) lines = atoi(tok);
+ if(tok) lines = str2i(tok);
if(lines < 1) lines = 1;
}
if(url) {
// parse the group count required
tok = mystrsep(&url, "/");
- if(tok && *tok) group_count = atoi(tok);
+ if(tok && *tok) group_count = str2i(tok);
if(group_count < 1) group_count = 1;
//if(group_count > save_history / 20) group_count = save_history / 20;
}
if(url) {
// parse after time
tok = mystrsep(&url, "/");
- if(tok && *tok) after = strtoul(tok, NULL, 10);
+ if(tok && *tok) after = str2ul(tok);
if(after < 0) after = 0;
}
if(url) {
// parse before time
tok = mystrsep(&url, "/");
- if(tok && *tok) before = strtoul(tok, NULL, 10);
+ if(tok && *tok) before = str2ul(tok);
if(before < 0) before = 0;
}
if(url) {