Home | History | Annotate | Download | only in bin

Lines Matching refs:Profile

33 # Program for printing the profile generated by common/profiler.cc,
36 # The profile contains a sequence of entries of the form:
38 # This program parses the profile, and generates user-readable
43 # % tools/jeprof "program" "profile"
46 # % tools/jeprof --text "program" "profile"
49 # % tools/jeprof --gv "program" "profile"
52 # % tools/jeprof --gv --focus=Mutex "program" "profile"
55 # % tools/jeprof --gv --focus=Mutex --ignore=string "program" "profile"
59 # % tools/jeprof --list=IBF_CheckDocid "program" "profile"
64 # % tools/jeprof --disasm=IBF_CheckDocid "program" "profile"
102 my $PROFILE_PAGE = "/pprof/profile"; # must support cgi-param "?seconds=#"
149 <profiles> is a space separated list of profile names.
151 <symbolized-profiles> is a list of profile files where each file contains
152 the necessary symbol mappings as well as profile data (likely generated
154 jeprof [options] <profile>
155 <profile> is a remote form. Symbols are obtained from host:port$SYMBOL_PAGE
158 /path/to/profile - a path to a profile file
159 host:port[/<service>] - a location of a service to get profile from
170 and cpu-profile files (this loosely matches that of /proc/self/maps
180 --base=<base> Subtract <base> from <profile> before display
208 Heap-Profile Options:
216 Contention-profile options:
227 --thread=<n> Show profile for thread <n>
270 Fetches a remote profile for later analysis and then
374 # Type of profile we are dealing with
511 # Binary name and profile arguments list
521 $main::prog = $UNKNOWN_BINARY; # will be set later from the profile file
533 scalar(@ARGV) || usage("Did not specify profile file");
539 scalar(@ARGV) || usage("Did not specify profile file");
542 # Parse profile file/location arguments
558 error("The first profile should be a remote form to use $SYMBOL_PAGE\n");
577 my ($profile, $symbols, $libs, $thread) = @_;
579 # Get total data in profile
580 my $total = TotalProfile($profile);
583 $profile = RemoveUninterestingFrames($symbols, $profile);
587 $profile = FocusProfile($symbols, $profile, $main::opt_focus);
592 $profile = IgnoreProfile($symbols, $profile, $main::opt_ignore);
595 my $calls = ExtractCalls($symbols, $profile);
599 my $reduced = ReduceProfile($symbols, $profile);
622 PrintSymbolizedProfile($symbols, $profile, $main::prog);
626 if (PrintDot($main::prog, $symbols, $profile, $flat, $cumulative, $total)) {
652 InteractiveMode($profile, $symbols, $libs, $total);
668 # Fetch all profile data
671 # this will hold symbols that we read from the profile files
674 # Read one profile, pick the last item on the list
676 my $profile = $data->{profile};
685 $profile = AddProfile($profile, $data2->{profile});
691 # Subtract base from profile, if specified
694 $profile = SubtractProfile($profile, $base->{profile});
714 FilterAndPrint($profile, $symbols, $libs);
846 # Takes two args: orig profile, and command to run.
880 my $profile = ProcessProfile($total, $orig_profile, $symbols, "", $ignore);
881 my $reduced = ReduceProfile($symbols, $profile);
915 my $profile = ProcessProfile($total, $orig_profile, $symbols, "", $ignore);
916 my $reduced = ReduceProfile($symbols, $profile);
932 # Process current profile to account for various settings
933 my $profile = ProcessProfile($total, $orig_profile, $symbols, "", $ignore);
934 my $reduced = ReduceProfile($symbols, $profile);
959 # Process current profile to account for various settings
960 my $profile = ProcessProfile($total, $orig_profile, $symbols,
962 my $reduced = ReduceProfile($symbols, $profile);
968 if (PrintDot($main::prog, $symbols, $profile, $flat, $cumulative, $total)) {
995 # Process current profile to account for various settings
996 my $profile = $orig_profile;
999 $profile = FocusProfile($symbols, $profile, $focus);
1000 my $focus_count = TotalProfile($profile);
1007 $profile = IgnoreProfile($symbols, $profile, $ignore);
1008 my $ignore_count = TotalProfile($profile);
1016 return $profile;
1026 Show graphical hierarchical display of current profile. Without
1027 any arguments, shows all samples in the profile. With the optional
1034 Like GV, but displays profile in your web browser instead of using
1051 Show top lines ordered by flat profile count, or cumulative count
1109 # Print profile data in packed binary format (64-bit) to standard out
1111 my $profile = shift;
1117 foreach my $k (keys(%{$profile})) {
1118 my $count = $profile->{$k};
1131 print STDERR "Invalid address in profile: $full_addr\n";
1142 # Print symbols and profile data
1145 my $profile = shift;
1186 # if used with remote fetch, simply dump the collected profile to output.
1194 # would need to extend PrintProfileData() to handle all possible profile
1196 # and FixCallerAddresses(), and remove the remote profile dumping code in
1199 # dump a cpu-format profile to standard out
1200 PrintProfileData($profile);
1213 # Which profile to sort by?
1648 # density profile or just print all regions we find.
2756 ##### Profile manipulation code #####
2758 # Generate flattened profile:
2759 # If count is charged to stack [a,b,c,d], in generated profile,
2762 my $profile = shift;
2764 foreach my $k (keys(%{$profile})) {
2765 my $count = $profile->{$k};
2774 # Generate cumulative profile:
2775 # If count is charged to stack [a,b,c,d], in generated profile,
2778 my $profile = shift;
2780 foreach my $k (keys(%{$profile})) {
2781 my $count = $profile->{$k};
2793 my $profile = shift;
2796 foreach my $k (keys(%{$profile})) {
2831 my $profile = shift;
2834 while( my ($stack_trace, $count) = each %$profile ) {
2851 my $profile = shift;
2854 return $profile;
2858 foreach my $k (keys(%{$profile})) {
2859 my $count = $profile->{$k};
2888 my $profile = shift;
2969 # Drop signal handlers used for CPU profile collection
2991 while (my $second_pc = IsSecondPcAlwaysTheSame($profile)) {
2998 foreach my $k (keys(%{$profile})) {
2999 my $count = $profile->{$k};
3005 $profile = $result;
3010 foreach my $k (keys(%{$profile})) {
3011 my $count = $profile->{$k};
3036 # Reduce profile to granularity given by user
3039 my $profile = shift;
3043 foreach my $k (keys(%{$profile})) {
3044 my $count = $profile->{$k};
3080 my $profile = shift;
3083 foreach my $k (keys(%{$profile})) {
3084 my $count = $profile->{$k};
3100 my $profile = shift;
3103 foreach my $k (keys(%{$profile})) {
3104 my $count = $profile->{$k};
3121 # Get total count in profile
3123 my $profile = shift;
3125 foreach my $k (keys(%{$profile})) {
3126 $result += $profile->{$k};
3199 # Take care of when subtracted profile has more entries
3209 # Get entry from profile; zero if not present
3211 my $profile = shift;
3213 if (exists($profile->{$k})) {
3214 return $profile->{$k};
3220 # Add entry to specified profile
3222 my $profile = shift;
3225 if (!exists($profile->{$k})) {
3226 $profile->{$k} = 0;
3228 $profile->{$k} += $n;
3231 # Add a stack of entries to specified profile, and add them to the $pcs
3234 my $profile = shift;
3245 AddEntry($profile, (join "\n", @k), $count);
3248 ##### Code to profile a server dynamically #####
3286 # Split profile URL - matches all non-empty strings, so no test.
3292 my $profile = $4 || "/";
3298 return ($host, $baseurl, $profile);
3301 # We fetch symbols from the first profile argument.
3409 # Fetches and processes symbols to prepare them for use in the profile output
3411 # $SYMBOL_PAGE for all PC values found in profile. Otherwise, the raw symbols
3502 # Missing type specifier defaults to cpu-profile
3522 # the target profile file name.
3539 || die("Unable to create profile directory $profile_dir: $!\n");
3551 print STDERR "Gathering CPU profile from $url for $main::opt_seconds seconds to\n ${real_profile}\n";
3556 print STDERR "Fetching $path profile from $url to\n ${real_profile}\n";
3559 (system($cmd) == 0) || error("Failed to get profile: $cmd: $!\n");
3560 (system("mv", $tmp_profile, $real_profile) == 0) || error("Unable to rename profile\n");
3561 print STDERR "Wrote profile to $real_profile\n";
3608 # Collect a single profile
3626 # cpu-profile files. Stream in chunks along a sliding window.
3629 # (depending on the input profile). We tell endianness and bit-size
3630 # for the profile by looking at the first 8 bytes: in cpu profiles,
3642 perl_is_64bit => 1, # matters if profile is 64-bit
3666 # If we're a 64-bit profile, check if we're a 64-bit-capable
3718 ::error("Need a 64-bit perl to process this 64-bit profile.\n");
3736 print STDERR "Unexpected look-back reading CPU profile";
3749 # Reads the top, 'header' section of a profile, and returns the last
3751 # section of a profile consists of zero or more 'command' lines that
3754 # lines is the 'header line', which is a profile-specific line that
3755 # indicates what type of profile it is, and perhaps other global
3756 # information about the profile. For instance, here's a header line
3757 # for a heap profile:
3758 # heap profile: 53: 38236 [ 5525: 1284029] @ heapprofile
3759 # For historical reasons, the CPU profile does not contain a text-
3760 # readable header line. If the profile looks like a CPU profile,
3769 local *PROFILE = shift;
3772 read(PROFILE, $firstchar, 1);
3773 seek(PROFILE, -1, 1); # unread the firstchar
3777 while (defined($line = <PROFILE>)) {
3783 print STDERR "Ignoring unknown command from profile header: $line";
3810 # Parse profile generated by common/profiler.cc and return a reference
3812 # $result->{version} Version number of profile file
3814 # $result->{profile} Profile object
3815 # $result->{threads} Map of thread IDs to profile objects
3816 # $result->{map} Memory map info from profile
3834 # Look at first line to see if it is a heap or a CPU profile.
3835 # CPU profile may start with no header at all, and just binary data
3838 open(PROFILE, "<$fname") || error("$fname: $!\n");
3839 binmode PROFILE; # New perls do UTF-8 processing
3840 my $header = ReadProfileHeader(*PROFILE);
3842 error("Profile is empty.\n");
3847 # Verify that the user asked for a symbolized profile
3850 error("FATAL ERROR: Symbolized profile\n $fname\ncannot be used with " .
3853 # Read the symbol section of the symbolized profile file.
3854 $symbols = ReadSymbols(*PROFILE{IO});
3855 # Read the next line to get the header for the remaining profile.
3856 $header = ReadProfileHeader(*PROFILE) || "";
3860 # Skip "--- ..." line for profile types that have their own headers.
3861 $header = ReadProfileHeader(*PROFILE) || "";
3866 if ($header =~ m/^heap profile:.*$growth_marker/o) {
3868 $result = ReadHeapProfile($prog, *PROFILE, $header);
3869 } elsif ($header =~ m/^heap profile:/) {
3871 $result = ReadHeapProfile($prog, *PROFILE, $header);
3877 $result = ReadSynchProfile($prog, *PROFILE);
3880 "Old format contention profile: mistakenly reports " .
3883 $result = ReadSynchProfile($prog, *PROFILE);
3885 # the binary cpu profile data starts immediately after this line
3887 $result = ReadCPUProfile($prog, $fname, *PROFILE);
3890 # a symbolized profile contains a format we don't recognize, bail out
3891 error("$fname: Cannot recognize profile section after symbols.\n");
3893 # no ascii header present -- must be a CPU profile
3895 $result = ReadCPUProfile($prog, $fname, *PROFILE);
3898 close(PROFILE);
3900 # if we got symbols along with the profile, return those as well
3909 # However, don't do this if we're reading a symbolized profile
3935 # CPU profile reader
3939 local *PROFILE = shift;
3943 my $profile = {};
3947 my $slots = CpuProfileStream->new(*PROFILE, $fname);
3957 error("$fname: not a profile file, or old format profile file\n");
3964 error("$fname: not a profile file, or corrupted profile file\n");
3967 # Parse profile
3977 # End of profile data marker
3993 AddEntry($profile, (join "\n", @k), $n);
3999 seek(PROFILE, $i * 4, 0);
4000 read(PROFILE, $map, (stat PROFILE)[7]);
4005 $r->{profile} = $profile;
4042 while (<PROFILE>) {
4097 local *PROFILE = shift;
4102 # Find the type of this profile. The header line looks like:
4103 # heap profile: 1246: 8800744 [ 1246: 8800744] @ <heap-url>/266053
4105 # second allocated objects/space. This is followed optionally by a profile
4120 # heap profile: 1922: 127792360 [ 1922: 127792360] @ <heap-url>_v2/524288
4127 if ($header =~ m"^heap profile:\s*(\d+):\s+(\d+)\s+\[\s*(\d+):\s+(\d+)\](\s*@\s*([^/]*)(/(\d+))?)?") {
4152 # We detect whether or not this is a remote-heap profile by checking
4155 # that a non-remote-heap profile may pass this check, but it is hard
4160 # This is likely to be a remote-heap based sample profile
4170 # Turn on profile adjustment.
4183 my $profile = {};
4187 while (<PROFILE>) {
4190 $map .= ReadMappedLibraries(*PROFILE);
4195 $map .= ReadMemoryMap(*PROFILE);
4208 AddEntries($profile, $pcs, FixCallerAddresses($stack), $counts[$index]);
4215 $r->{profile} = $profile;
4239 my $profile = {};
4245 while (<PROFILE>) {
4248 $map .= ReadMappedLibraries(*PROFILE);
4253 $map .= ReadMemoryMap(*PROFILE);
4277 AddEntries($profile, $pcs, FixCallerAddresses($stack), $counts[$index]);
4291 $r->{profile} = $profile;
4300 local *PROFILE = shift;
4304 my $profile = {};
4320 while ( $line = <PROFILE> ) {
4333 AddEntries($profile, $pcs, FixCallerAddresses($stack), $values[$index]);
4348 AddEntries($profile, $pcs, FixCallerAddresses($stack), $cycles);
4378 printf STDERR ("No cycles/second entry in profile; Guessing %.1f GHz\n",
4385 $r->{profile} = $profile;
4828 # Extract symbols for all PC values found in profile
5213 profile is in $main::collected_profile\n";
5215 print STDERR "If you want to investigate this profile further, you can do:\n";