Home | History | Annotate | Download | only in src

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/pprof "program" "profile"
46 # % tools/pprof --text "program" "profile"
49 # % tools/pprof --gv "program" "profile"
52 # % tools/pprof --gv --focus=Mutex "program" "profile"
55 # % tools/pprof --gv --focus=Mutex --ignore=string "program" "profile"
59 # % tools/pprof --list=IBF_CheckDocid "program" "profile"
64 # % tools/pprof --disasm=IBF_CheckDocid "program" "profile"
101 my $PROFILE_PAGE = "/pprof/profile"; # must support cgi-param "?seconds=#"
148 <profiles> is a space separated list of profile names.
150 <symbolized-profiles> is a list of profile files where each file contains
151 the necessary symbol mappings as well as profile data (likely generated
153 pprof [options] <profile>
154 <profile> is a remote form. Symbols are obtained from host:port$SYMBOL_PAGE
157 /path/to/profile - a path to a profile file
158 host:port[/<service>] - a location of a service to get profile from
169 and cpu-profile files (this loosely matches that of /proc/self/maps
179 --base=<base> Subtract <base> from <profile> before display
207 Heap-Profile Options:
215 Contention-profile options:
266 Fetches a remote profile for later analysis and then
366 # Type of profile we are dealing with
500 # Binary name and profile arguments list
510 $main::prog = $UNKNOWN_BINARY; # will be set later from the profile file
522 scalar(@ARGV) || usage("Did not specify profile file");
528 scalar(@ARGV) || usage("Did not specify profile file");
531 # Parse profile file/location arguments
547 error("The first profile should be a remote form to use $SYMBOL_PAGE\n");
577 # Fetch all profile data
580 # this will hold symbols that we read from the profile files
583 # Read one profile, pick the last item on the list
585 my $profile = $data->{profile};
594 $profile = AddProfile($profile, $data2->{profile});
600 # Subtract base from profile, if specified
603 $profile = SubtractProfile($profile, $base->{profile});
608 # Get total data in profile
609 my $total = TotalProfile($profile);
626 $profile = RemoveUninterestingFrames($symbols, $profile);
630 $profile = FocusProfile($symbols, $profile, $main::opt_focus);
635 $profile = IgnoreProfile($symbols, $profile, $main::opt_ignore);
638 my $calls = ExtractCalls($symbols, $profile);
642 my $reduced = ReduceProfile($symbols, $profile);
663 PrintSymbolizedProfile($symbols, $profile, $main::prog);
667 if (PrintDot($main::prog, $symbols, $profile, $flat, $cumulative, $total)) {
693 InteractiveMode($profile, $symbols, $libs, $total);
816 # Takes two args: orig profile, and command to run.
850 my $profile = ProcessProfile($total, $orig_profile, $symbols, "", $ignore);
851 my $reduced = ReduceProfile($symbols, $profile);
885 my $profile = ProcessProfile($total, $orig_profile, $symbols, "", $ignore);
886 my $reduced = ReduceProfile($symbols, $profile);
902 # Process current profile to account for various settings
903 my $profile = ProcessProfile($total, $orig_profile, $symbols, "", $ignore);
904 my $reduced = ReduceProfile($symbols, $profile);
929 # Process current profile to account for various settings
930 my $profile = ProcessProfile($total, $orig_profile, $symbols,
932 my $reduced = ReduceProfile($symbols, $profile);
938 if (PrintDot($main::prog, $symbols, $profile, $flat, $cumulative, $total)) {
965 # Process current profile
966 my $profile = $orig_profile;
969 $profile = FocusProfile($symbols, $profile, $focus);
970 my $focus_count = TotalProfile($profile);
977 $profile = IgnoreProfile($symbols, $profile, $ignore);
978 my $ignore_count = TotalProfile($profile);
986 return $profile;
996 Show graphical hierarchical display of current profile. Without
997 any arguments, shows all samples in the profile. With the optional
1004 Like GV, but displays profile in your web browser instead of using
1021 Show top lines ordered by flat profile count, or cumulative count
1079 # Print profile data in packed binary format (64-bit) to standard out
1081 my $profile = shift;
1087 foreach my $k (keys(%{$profile})) {
1088 my $count = $profile->{$k};
1101 print STDERR "Invalid address in profile: $full_addr\n";
1112 # Print symbols and profile data
1115 my $profile = shift;
1143 # if used with remote fetch, simply dump the collected profile to output.
1150 # dump a cpu-format profile to standard out
1151 PrintProfileData($profile);
1164 # Which profile to sort by?
1599 # density profile or just print all regions we find.
2707 ##### Profile manipulation code #####
2709 # Generate flattened profile:
2710 # If count is charged to stack [a,b,c,d], in generated profile,
2713 my $profile = shift;
2715 foreach my $k (keys(%{$profile})) {
2716 my $count = $profile->{$k};
2725 # Generate cumulative profile:
2726 # If count is charged to stack [a,b,c,d], in generated profile,
2729 my $profile = shift;
2731 foreach my $k (keys(%{$profile})) {
2732 my $count = $profile->{$k};
2744 my $profile = shift;
2747 foreach my $k (keys(%{$profile})) {
2782 my $profile = shift;
2785 while( my ($stack_trace, $count) = each %$profile ) {
2802 my $profile = shift;
2877 # Drop signal handlers used for CPU profile collection
2899 while (my $second_pc = IsSecondPcAlwaysTheSame($profile)) {
2906 foreach my $k (keys(%{$profile})) {
2907 my $count = $profile->{$k};
2913 $profile = $result;
2918 foreach my $k (keys(%{$profile})) {
2919 my $count = $profile->{$k};
2937 # Reduce profile to granularity given by user
2940 my $profile = shift;
2944 foreach my $k (keys(%{$profile})) {
2945 my $count = $profile->{$k};
2981 my $profile = shift;
2984 foreach my $k (keys(%{$profile})) {
2985 my $count = $profile->{$k};
3001 my $profile = shift;
3004 foreach my $k (keys(%{$profile})) {
3005 my $count = $profile->{$k};
3022 # Get total count in profile
3024 my $profile = shift;
3026 foreach my $k (keys(%{$profile})) {
3027 $result += $profile->{$k};
3100 # Take care of when subtracted profile has more entries
3110 # Get entry from profile; zero if not present
3112 my $profile = shift;
3114 if (exists($profile->{$k})) {
3115 return $profile->{$k};
3121 # Add entry to specified profile
3123 my $profile = shift;
3126 if (!exists($profile->{$k})) {
3127 $profile->{$k} = 0;
3129 $profile->{$k} += $n;
3132 # Add a stack of entries to specified profile, and add them to the $pcs
3135 my $profile = shift;
3146 AddEntry($profile, (join "\n", @k), $count);
3149 ##### Code to profile a server dynamically #####
3187 # Split profile URL - matches all non-empty strings, so no test.
3193 my $profile = $4 || "/";
3199 return ($host, $baseurl, $profile);
3202 # We fetch symbols from the first profile argument.
3289 # Fetches and processes symbols to prepare them for use in the profile output
3291 # $SYMBOL_PAGE for all PC values found in profile. Otherwise, the raw symbols
3380 # Missing type specifier defaults to cpu-profile
3398 # the target profile file name.
3407 || die("Unable to create profile directory $profile_dir: $!\n");
3419 print STDERR "Gathering CPU profile from $url for $main::opt_seconds seconds to\n ${real_profile}\n";
3424 print STDERR "Fetching $path profile from $url to\n ${real_profile}\n";
3427 (system($cmd) == 0) || error("Failed to get profile: $cmd: $!\n");
3428 (system("mv", $tmp_profile, $real_profile) == 0) || error("Unable to rename profile\n");
3429 print STDERR "Wrote profile to $real_profile\n";
3476 # Collect a single profile
3494 # cpu-profile files. Stream in chunks along a sliding window.
3497 # (depending on the input profile). We tell endianness and bit-size
3498 # for the profile by looking at the first 8 bytes: in cpu profiles,
3510 perl_is_64bit => 1, # matters if profile is 64-bit
3534 # If we're a 64-bit profile, check if we're a 64-bit-capable
3586 ::error("Need a 64-bit perl to process this 64-bit profile.\n");
3604 print STDERR "Unexpected look-back reading CPU profile";
3617 # Reads the top, 'header' section of a profile, and returns the last
3619 # section of a profile consists of zero or more 'command' lines that
3622 # lines is the 'header line', which is a profile-specific line that
3623 # indicates what type of profile it is, and perhaps other global
3624 # information about the profile. For instance, here's a header line
3625 # for a heap profile:
3626 # heap profile: 53: 38236 [ 5525: 1284029] @ heapprofile
3627 # For historical reasons, the CPU profile does not contain a text-
3628 # readable header line. If the profile looks like a CPU profile,
3637 local *PROFILE = shift;
3640 read(PROFILE, $firstchar, 1);
3641 seek(PROFILE, -1, 1); # unread the firstchar
3645 while (defined($line = <PROFILE>)) {
3651 print STDERR "Ignoring unknown command from profile header: $line";
3678 # Parse profile generated by common/profiler.cc and return a reference
3680 # $result->{version} Version number of profile file
3682 # $result->{profile} Profile object
3683 # $result->{map} Memory map info from profile
3699 # Look at first line to see if it is a heap or a CPU profile.
3700 # CPU profile may start with no header at all, and just binary data
3703 open(PROFILE, "<$fname") || error("$fname: $!\n");
3704 binmode PROFILE; # New perls do UTF-8 processing
3705 my $header = ReadProfileHeader(*PROFILE);
3707 error("Profile is empty.\n");
3712 # Verify that the user asked for a symbolized profile
3715 error("FATAL ERROR: Symbolized profile\n $fname\ncannot be used with " .
3718 # Read the symbol section of the symbolized profile file.
3719 $symbols = ReadSymbols(*PROFILE{IO});
3720 # Read the next line to get the header for the remaining profile.
3721 $header = ReadProfileHeader(*PROFILE) || "";
3725 if ($header =~ m/^heap profile:.*$growth_marker/o) {
3727 $result = ReadHeapProfile($prog, *PROFILE, $header);
3728 } elsif ($header =~ m/^heap profile:/) {
3730 $result = ReadHeapProfile($prog, *PROFILE, $header);
3733 $result = ReadSynchProfile($prog, *PROFILE);
3736 "Old format contention profile: mistakenly reports " .
3739 $result = ReadSynchProfile($prog, *PROFILE);
3741 # the binary cpu profile data starts immediately after this line
3743 $result = ReadCPUProfile($prog, $fname, *PROFILE);
3746 # a symbolized profile contains a format we don't recognize, bail out
3747 error("$fname: Cannot recognize profile section after symbols.\n");
3749 # no ascii header present -- must be a CPU profile
3751 $result = ReadCPUProfile($prog, $fname, *PROFILE);
3754 close(PROFILE);
3756 # if we got symbols along with the profile, return those as well
3765 # However, don't do this if we're reading a symbolized profile
3791 # CPU profile reader
3795 local *PROFILE = shift;
3799 my $profile = {};
3803 my $slots = CpuProfileStream->new(*PROFILE, $fname);
3813 error("$fname: not a profile file, or old format profile file\n");
3820 error("$fname: not a profile file, or corrupted profile file\n");
3823 # Parse profile
3833 # End of profile data marker
3843 # However, don't do this if we're reading a symbolized profile
3854 AddEntry($profile, (join "\n", @k), $n);
3860 seek(PROFILE, $i * 4, 0);
3861 read(PROFILE, $map, (stat PROFILE)[7]);
3866 $r->{profile} = $profile;
3875 local *PROFILE = shift;
3889 # Find the type of this profile. The header line looks like:
3890 # heap profile: 1246: 8800744 [ 1246: 8800744] @ <heap-url>/266053
3892 # second allocated objects/space. This is followed optionally by a profile
3907 # heap profile: 1922: 127792360 [ 1922: 127792360] @ <heap-url>_v2/524288
3914 if ($header =~ m"^heap profile:\s*(\d+):\s+(\d+)\s+\[\s*(\d+):\s+(\d+)\](\s*@\s*([^/]*)(/(\d+))?)?") {
3939 # We detect whether or not this is a remote-heap profile by checking
3942 # that a non-remote-heap profile may pass this check, but it is hard
3947 # This is likely to be a remote-heap based sample profile
3957 # Turn on profile adjustment.
3970 my $profile = {};
3974 while (<PROFILE>) {
3978 while (<PROFILE>) {
3988 while (<PROFILE>) {
4046 AddEntries($profile, $pcs, FixCallerAddresses($stack), $counts[$index]);
4053 $r->{profile} = $profile;
4061 local *PROFILE = shift;
4065 my $profile = {};
4081 while ( $line = <PROFILE> ) {
4094 AddEntries($profile, $pcs, FixCallerAddresses($stack), $values[$index]);
4109 AddEntries($profile, $pcs, FixCallerAddresses($stack), $cycles);
4139 printf STDERR ("No cycles/second entry in profile; Guessing %.1f GHz\n",
4146 $r->{profile} = $profile;
4571 # Extract symbols for all PC values found in profile
4950 print STDERR "Dynamically gathered profile is in $main::collected_profile\n";
4952 print STDERR "If you want to investigate this profile further, you can do:\n";