sock.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #undef TRACE_SYSTEM
  2. #define TRACE_SYSTEM sock
  3. #if !defined(_TRACE_SOCK_H) || defined(TRACE_HEADER_MULTI_READ)
  4. #define _TRACE_SOCK_H
  5. #include <net/sock.h>
  6. #include <linux/tracepoint.h>
  7. TRACE_EVENT(sock_rcvqueue_full,
  8. TP_PROTO(struct sock *sk, struct sk_buff *skb),
  9. TP_ARGS(sk, skb),
  10. TP_STRUCT__entry(
  11. __field(int, rmem_alloc)
  12. __field(unsigned int, truesize)
  13. __field(int, sk_rcvbuf)
  14. ),
  15. TP_fast_assign(
  16. __entry->rmem_alloc = atomic_read(&sk->sk_rmem_alloc);
  17. __entry->truesize = skb->truesize;
  18. __entry->sk_rcvbuf = sk->sk_rcvbuf;
  19. ),
  20. TP_printk("rmem_alloc=%d truesize=%u sk_rcvbuf=%d",
  21. __entry->rmem_alloc, __entry->truesize, __entry->sk_rcvbuf)
  22. );
  23. TRACE_EVENT(sock_exceed_buf_limit,
  24. TP_PROTO(struct sock *sk, struct proto *prot, long allocated),
  25. TP_ARGS(sk, prot, allocated),
  26. TP_STRUCT__entry(
  27. __array(char, name, 32)
  28. __field(long *, sysctl_mem)
  29. __field(long, allocated)
  30. __field(int, sysctl_rmem)
  31. __field(int, rmem_alloc)
  32. ),
  33. TP_fast_assign(
  34. strncpy(__entry->name, prot->name, 32);
  35. __entry->sysctl_mem = prot->sysctl_mem;
  36. __entry->allocated = allocated;
  37. __entry->sysctl_rmem = prot->sysctl_rmem[0];
  38. __entry->rmem_alloc = atomic_read(&sk->sk_rmem_alloc);
  39. ),
  40. TP_printk("proto:%s sysctl_mem=%ld,%ld,%ld allocated=%ld "
  41. "sysctl_rmem=%d rmem_alloc=%d",
  42. __entry->name,
  43. __entry->sysctl_mem[0],
  44. __entry->sysctl_mem[1],
  45. __entry->sysctl_mem[2],
  46. __entry->allocated,
  47. __entry->sysctl_rmem,
  48. __entry->rmem_alloc)
  49. );
  50. #endif /* _TRACE_SOCK_H */
  51. /* This part must be outside protection */
  52. #include <trace/define_trace.h>