taskstats.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* taskstats.h - exporting per-task statistics
  2. *
  3. * Copyright (C) Shailabh Nagar, IBM Corp. 2006
  4. * (C) Balbir Singh, IBM Corp. 2006
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms of version 2.1 of the GNU Lesser General Public License
  8. * as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope that it would be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. */
  14. #ifndef _LINUX_TASKSTATS_H
  15. #define _LINUX_TASKSTATS_H
  16. /* Format for per-task data returned to userland when
  17. * - a task exits
  18. * - listener requests stats for a task
  19. *
  20. * The struct is versioned. Newer versions should only add fields to
  21. * the bottom of the struct to maintain backward compatibility.
  22. *
  23. *
  24. * To add new fields
  25. * a) bump up TASKSTATS_VERSION
  26. * b) add comment indicating new version number at end of struct
  27. * c) add new fields after version comment; maintain 64-bit alignment
  28. */
  29. #define TASKSTATS_VERSION 1
  30. struct taskstats {
  31. /* Version 1 */
  32. __u64 version;
  33. };
  34. #define TASKSTATS_LISTEN_GROUP 0x1
  35. /*
  36. * Commands sent from userspace
  37. * Not versioned. New commands should only be inserted at the enum's end
  38. * prior to __TASKSTATS_CMD_MAX
  39. */
  40. enum {
  41. TASKSTATS_CMD_UNSPEC = 0, /* Reserved */
  42. TASKSTATS_CMD_GET, /* user->kernel request/get-response */
  43. TASKSTATS_CMD_NEW, /* kernel->user event */
  44. __TASKSTATS_CMD_MAX,
  45. };
  46. #define TASKSTATS_CMD_MAX (__TASKSTATS_CMD_MAX - 1)
  47. enum {
  48. TASKSTATS_TYPE_UNSPEC = 0, /* Reserved */
  49. TASKSTATS_TYPE_PID, /* Process id */
  50. TASKSTATS_TYPE_TGID, /* Thread group id */
  51. TASKSTATS_TYPE_STATS, /* taskstats structure */
  52. TASKSTATS_TYPE_AGGR_PID, /* contains pid + stats */
  53. TASKSTATS_TYPE_AGGR_TGID, /* contains tgid + stats */
  54. __TASKSTATS_TYPE_MAX,
  55. };
  56. #define TASKSTATS_TYPE_MAX (__TASKSTATS_TYPE_MAX - 1)
  57. enum {
  58. TASKSTATS_CMD_ATTR_UNSPEC = 0,
  59. TASKSTATS_CMD_ATTR_PID,
  60. TASKSTATS_CMD_ATTR_TGID,
  61. __TASKSTATS_CMD_ATTR_MAX,
  62. };
  63. #define TASKSTATS_CMD_ATTR_MAX (__TASKSTATS_CMD_ATTR_MAX - 1)
  64. /* NETLINK_GENERIC related info */
  65. #define TASKSTATS_GENL_NAME "TASKSTATS"
  66. #define TASKSTATS_GENL_VERSION 0x1
  67. #endif /* _LINUX_TASKSTATS_H */