1 /** 2 * collectd - src/utils_taskstats.h 3 * Copyright (C) 2017 Florian octo Forster 4 * 5 * ISC License (ISC) 6 * 7 * Permission to use, copy, modify, and/or distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 * 19 * Authors: 20 * Florian octo Forster <octo at collectd.org> 21 */ 22 23 #ifndef UTILS_TASKSTATS_H 24 #define UTILS_TASKSTATS_H 1 25 26 #include "collectd.h" 27 28 #include "utils_time.h" 29 30 struct ts_s; 31 typedef struct ts_s ts_t; 32 33 typedef struct { 34 uint64_t cpu_ns; 35 uint64_t blkio_ns; 36 uint64_t swapin_ns; 37 uint64_t freepages_ns; 38 } ts_delay_t; 39 40 ts_t *ts_create(void); 41 void ts_destroy(ts_t *); 42 43 /* ts_delay_by_tgid returns Linux delay accounting information for the task 44 * identified by tgid. Returns zero on success and an errno otherwise. */ 45 int ts_delay_by_tgid(ts_t *ts, uint32_t tgid, ts_delay_t *out); 46 47 #endif /* UTILS_TASKSTATS_H */ 48