fprintf: Show statistics about holes due to forced alignments

  $ pahole -C task_struct | tail

	/* --- cacheline 104 boundary (6656 bytes) --- */
	struct thread_struct       thread __attribute__((__aligned__(64)); /*  6656  4352 */

	/* size: 11008, cachelines: 172, members: 207 */
	/* sum members: 10902, holes: 16, sum holes: 98 */
	/* sum bitfield members: 10 bits, bit holes: 2, sum bit holes: 54 bits */
	/* paddings: 3, sum paddings: 14 */
	/* forced alignments: 6, forced holes: 1, sum forced holes: 40 */
  };
  $ pahole -C inet_timewait_death_row
  struct inet_timewait_death_row {
	atomic_t                   tw_count;             /*     0     4 */

	/* XXX 60 bytes hole, try to pack */

	/* --- cacheline 1 boundary (64 bytes) --- */
	struct inet_hashinfo *     hashinfo __attribute__((__aligned__(64)); /*    64     8 */
	int                        sysctl_max_tw_buckets; /*    72     4 */

	/* size: 128, cachelines: 2, members: 3 */
	/* sum members: 16, holes: 1, sum holes: 60 */
	/* padding: 52 */
	/* forced alignments: 1, forced holes: 1, sum forced holes: 60 */
  };
  $

Cc: Alexei Starovoitov <ast@fb.com>
Cc: Andrii Nakryiko <andriin@fb.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Wielaard <mark@klomp.org>
Cc: Yonghong Song <yhs@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 file changed