random.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM random
  3. #if !defined(_TRACE_RANDOM_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _TRACE_RANDOM_H
  5. #include <linux/writeback.h>
  6. #include <linux/tracepoint.h>
  7. DECLARE_EVENT_CLASS(random__mix_pool_bytes,
  8. TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
  9. TP_ARGS(pool_name, bytes, IP),
  10. TP_STRUCT__entry(
  11. __field( const char *, pool_name )
  12. __field( int, bytes )
  13. __field(unsigned long, IP )
  14. ),
  15. TP_fast_assign(
  16. __entry->pool_name = pool_name;
  17. __entry->bytes = bytes;
  18. __entry->IP = IP;
  19. ),
  20. TP_printk("%s pool: bytes %d caller %pF",
  21. __entry->pool_name, __entry->bytes, (void *)__entry->IP)
  22. );
  23. DEFINE_EVENT(random__mix_pool_bytes, mix_pool_bytes,
  24. TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
  25. TP_ARGS(pool_name, bytes, IP)
  26. );
  27. DEFINE_EVENT(random__mix_pool_bytes, mix_pool_bytes_nolock,
  28. TP_PROTO(const char *pool_name, int bytes, unsigned long IP),
  29. TP_ARGS(pool_name, bytes, IP)
  30. );
  31. TRACE_EVENT(credit_entropy_bits,
  32. TP_PROTO(const char *pool_name, int bits, int entropy_count,
  33. int entropy_total, unsigned long IP),
  34. TP_ARGS(pool_name, bits, entropy_count, entropy_total, IP),
  35. TP_STRUCT__entry(
  36. __field( const char *, pool_name )
  37. __field( int, bits )
  38. __field( int, entropy_count )
  39. __field( int, entropy_total )
  40. __field(unsigned long, IP )
  41. ),
  42. TP_fast_assign(
  43. __entry->pool_name = pool_name;
  44. __entry->bits = bits;
  45. __entry->entropy_count = entropy_count;
  46. __entry->entropy_total = entropy_total;
  47. __entry->IP = IP;
  48. ),
  49. TP_printk("%s pool: bits %d entropy_count %d entropy_total %d "
  50. "caller %pF", __entry->pool_name, __entry->bits,
  51. __entry->entropy_count, __entry->entropy_total,
  52. (void *)__entry->IP)
  53. );
  54. TRACE_EVENT(get_random_bytes,
  55. TP_PROTO(int nbytes, unsigned long IP),
  56. TP_ARGS(nbytes, IP),
  57. TP_STRUCT__entry(
  58. __field( int, nbytes )
  59. __field(unsigned long, IP )
  60. ),
  61. TP_fast_assign(
  62. __entry->nbytes = nbytes;
  63. __entry->IP = IP;
  64. ),
  65. TP_printk("nbytes %d caller %pF", __entry->nbytes, (void *)__entry->IP)
  66. );
  67. DECLARE_EVENT_CLASS(random__extract_entropy,
  68. TP_PROTO(const char *pool_name, int nbytes, int entropy_count,
  69. unsigned long IP),
  70. TP_ARGS(pool_name, nbytes, entropy_count, IP),
  71. TP_STRUCT__entry(
  72. __field( const char *, pool_name )
  73. __field( int, nbytes )
  74. __field( int, entropy_count )
  75. __field(unsigned long, IP )
  76. ),
  77. TP_fast_assign(
  78. __entry->pool_name = pool_name;
  79. __entry->nbytes = nbytes;
  80. __entry->entropy_count = entropy_count;
  81. __entry->IP = IP;
  82. ),
  83. TP_printk("%s pool: nbytes %d entropy_count %d caller %pF",
  84. __entry->pool_name, __entry->nbytes, __entry->entropy_count,
  85. (void *)__entry->IP)
  86. );
  87. DEFINE_EVENT(random__extract_entropy, extract_entropy,
  88. TP_PROTO(const char *pool_name, int nbytes, int entropy_count,
  89. unsigned long IP),
  90. TP_ARGS(pool_name, nbytes, entropy_count, IP)
  91. );
  92. DEFINE_EVENT(random__extract_entropy, extract_entropy_user,
  93. TP_PROTO(const char *pool_name, int nbytes, int entropy_count,
  94. unsigned long IP),
  95. TP_ARGS(pool_name, nbytes, entropy_count, IP)
  96. );
  97. #endif /* _TRACE_RANDOM_H */
  98. /* This part must be outside protection */
  99. #include <trace/define_trace.h>