taskstats_kern.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* taskstats_kern.h - kernel header for per-task statistics interface
  2. *
  3. * Copyright (C) Shailabh Nagar, IBM Corp. 2006
  4. * (C) Balbir Singh, IBM Corp. 2006
  5. */
  6. #ifndef _LINUX_TASKSTATS_KERN_H
  7. #define _LINUX_TASKSTATS_KERN_H
  8. #include <linux/taskstats.h>
  9. #include <linux/sched.h>
  10. enum {
  11. TASKSTATS_MSG_UNICAST, /* send data only to requester */
  12. TASKSTATS_MSG_MULTICAST, /* send data to a group */
  13. };
  14. #ifdef CONFIG_TASKSTATS
  15. extern kmem_cache_t *taskstats_cache;
  16. static inline void taskstats_exit_alloc(struct taskstats **ptidstats,
  17. struct taskstats **ptgidstats)
  18. {
  19. *ptidstats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL);
  20. *ptgidstats = kmem_cache_zalloc(taskstats_cache, SLAB_KERNEL);
  21. }
  22. static inline void taskstats_exit_free(struct taskstats *tidstats,
  23. struct taskstats *tgidstats)
  24. {
  25. if (tidstats)
  26. kmem_cache_free(taskstats_cache, tidstats);
  27. if (tgidstats)
  28. kmem_cache_free(taskstats_cache, tgidstats);
  29. }
  30. extern void taskstats_exit_send(struct task_struct *, struct taskstats *,
  31. struct taskstats *);
  32. extern void taskstats_init_early(void);
  33. #else
  34. static inline void taskstats_exit_alloc(struct taskstats **ptidstats,
  35. struct taskstats **ptgidstats)
  36. {}
  37. static inline void taskstats_exit_free(struct taskstats *ptidstats,
  38. struct taskstats *ptgidstats)
  39. {}
  40. static inline void taskstats_exit_send(struct task_struct *tsk,
  41. struct taskstats *tidstats,
  42. struct taskstats *tgidstats)
  43. {}
  44. static inline void taskstats_init_early(void)
  45. {}
  46. #endif /* CONFIG_TASKSTATS */
  47. #endif