Skip to content
Snippets Groups Projects
Commit 1bfbb015 authored by Martin Perry's avatar Martin Perry Committed by David Bigagli
Browse files

Complete the code for bug #449"

parent fd38c5ad
No related branches found
No related tags found
No related merge requests found
......@@ -105,8 +105,13 @@ static slurm_cgroup_conf_t slurm_cgroup_conf;
static void _prec_extra(jag_prec_t *prec, int pagesize)
{
int utime, stime, total_rss, total_pgpgin;
int dev_major;
uint64_t read_bytes, write_bytes, tot_read, tot_write;
char *cpu_time, *memory_stat, *ptr;
char *blkio_bytes, *next_device;
size_t cpu_time_size, memory_stat_size;
size_t blkio_bytes_size;
//DEF_TIMERS;
//START_TIMER;
/* info("before"); */
......@@ -129,9 +134,34 @@ static void _prec_extra(jag_prec_t *prec, int pagesize)
/* total_pgmajfault is what is reported in proc, so we use
* the same thing here. */
ptr = strstr(memory_stat, "total_pgmajfault");
sscanf(ptr, "total_pgmajfault %u", &total_pgpgin);
prec->pages = total_pgpgin;
if ((ptr = strstr(memory_stat, "total_pgmajfault"))) {
sscanf(ptr, "total_pgmajfault %u", &total_pgpgin);
prec->pages = total_pgpgin;
}
/* "Read" and "Write" from blkio.throttle.io_service_bytes are
* counts of bytes read and written for physical disk I/Os only.
* These counts do not include disk I/Os satisfied from cache.
*/
xcgroup_get_param(&task_blkio_cg, "blkio.throttle.io_service_bytes",
&blkio_bytes, &blkio_bytes_size);
next_device = blkio_bytes;
tot_read = tot_write = 0;
while ((sscanf(next_device, "%d:", &dev_major)) > 0) {
if ((dev_major > 239) && (dev_major < 255))
/* skip experimental device codes */
continue;
next_device = strstr(next_device, "Read");
sscanf(next_device, "%*s %"PRIu64"", &read_bytes);
next_device = strstr(next_device, "Write");
sscanf(next_device, "%*s %"PRIu64"", &write_bytes);
tot_read+=read_bytes;
tot_write+=write_bytes;
next_device = strstr(next_device, "Total");
}
prec->disk_read = (double)tot_read / (double)1048576;
prec->disk_write = (double)tot_write / (double)1048576;
/* info("after %d %d", total_rss, pagesize); */
/* print_jag_prec(prec); */
//END_TIMER;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment