citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

write_tus.pl (391B)


      1 #!/usr/bin/perl
      2 #
      3 # A little frontend for t::mem that prints the list of translation units.
      4 #
      5 # Usage: write_tus.pl output_file memory_file
      6 #
      7 use strict;
      8 use warnings;
      9 
     10 use t::mem;
     11 
     12 open( my $out, '>', $ARGV[0] ) or die $!;
     13 my $shm = t::mem->new( $ARGV[1] );
     14 
     15 my $tus = $shm->{trans_units};
     16 for (sort keys %$tus) {
     17 	my $tu = $tus->{$_};
     18 
     19 	print $out "$tu->{comp_file_name} $tu->{size}\n";
     20 }