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;
2882 # Drop signal handlers used for CPU profile collection
2904 while (my $second_pc = IsSecondPcAlwaysTheSame($profile)) {
2911 foreach my $k (keys(%{$profile})) {
2912 my $count = $profile->{$k};
2918 $profile = $result;
2923 foreach my $k (keys(%{$profile})) {
2924 my $count = $profile->{$k};
2946 # Reduce profile to granularity given by user
2949 my $profile = shift;
2953 foreach my $k (keys(%{$profile})) {
2954 my $count = $profile->{$k};
2990 my $profile = shift;
2993 foreach my $k (keys(%{$profile})) {
2994 my $count = $profile->{$k};
3010 my $profile = shift;
3013 foreach my $k (keys(%{$profile})) {
3014 my $count = $profile->{$k};
3031 # Get total count in profile
3033 my $profile = shift;
3035 foreach my $k (keys(%{$profile})) {
3036 $result += $profile->{$k};
3109 # Take care of when subtracted profile has more entries
3119 # Get entry from profile; zero if not present
3121 my $profile = shift;
3123 if (exists($profile->{$k})) {
3124 return $profile->{$k};
3130 # Add entry to specified profile
3132 my $profile = shift;
3135 if (!exists($profile->{$k})) {
3136 $profile->{$k} = 0;
3138 $profile->{$k} += $n;
3141 # Add a stack of entries to specified profile, and add them to the $pcs
3144 my $profile = shift;
3155 AddEntry($profile, (join "\n", @k), $count);
3158 ##### Code to profile a server dynamically #####
3196 # Split profile URL - matches all non-empty strings, so no test.
3202 my $profile = $4 || "/";
3208 return ($host, $baseurl, $profile);
3211 # We fetch symbols from the first profile argument.
3298 # Fetches and processes symbols to prepare them for use in the profile output
3300 # $SYMBOL_PAGE for all PC values found in profile. Otherwise, the raw symbols
3389 # Missing type specifier defaults to cpu-profile
3407 # the target profile file name.
3416 || die("Unable to create profile directory $profile_dir: $!\n");
3428 print STDERR "Gathering CPU profile from $url for $main::opt_seconds seconds to\n ${real_profile}\n";
3433 print STDERR "Fetching $path profile from $url to\n ${real_profile}\n";
3436 (system($cmd) == 0) || error("Failed to get profile: $cmd: $!\n");
3437 (system("mv", $tmp_profile, $real_profile) == 0) || error("Unable to rename profile\n");
3438 print STDERR "Wrote profile to $real_profile\n";
3485 # Collect a single profile
3503 # cpu-profile files. Stream in chunks along a sliding window.
3506 # (depending on the input profile). We tell endianness and bit-size
3507 # for the profile by looking at the first 8 bytes: in cpu profiles,
3519 perl_is_64bit => 1, # matters if profile is 64-bit
3543 # If we're a 64-bit profile, check if we're a 64-bit-capable
3595 ::error("Need a 64-bit perl to process this 64-bit profile.\n");
3613 print STDERR "Unexpected look-back reading CPU profile";
3626 # Reads the top, 'header' section of a profile, and returns the last
3628 # section of a profile consists of zero or more 'command' lines that
3631 # lines is the 'header line', which is a profile-specific line that
3632 # indicates what type of profile it is, and perhaps other global
3633 # information about the profile. For instance, here's a header line
3634 # for a heap profile:
3635 # heap profile: 53: 38236 [ 5525: 1284029] @ heapprofile
3636 # For historical reasons, the CPU profile does not contain a text-
3637 # readable header line. If the profile looks like a CPU profile,
3646 local *PROFILE = shift;
3649 read(PROFILE, $firstchar, 1);
3650 seek(PROFILE, -1, 1); # unread the firstchar
3654 while (defined($line = <PROFILE>)) {
3660 print STDERR "Ignoring unknown command from profile header: $line";
3687 # Parse profile generated by common/profiler.cc and return a reference
3689 # $result->{version} Version number of profile file
3691 # $result->{profile} Profile object
3692 # $result->{map} Memory map info from profile
3708 # Look at first line to see if it is a heap or a CPU profile.
3709 # CPU profile may start with no header at all, and just binary data
3712 open(PROFILE, "<$fname") || error("$fname: $!\n");
3713 binmode PROFILE; # New perls do UTF-8 processing
3714 my $header = ReadProfileHeader(*PROFILE);
3716 error("Profile is empty.\n");
3721 # Verify that the user asked for a symbolized profile
3724 error("FATAL ERROR: Symbolized profile\n $fname\ncannot be used with " .
3727 # Read the symbol section of the symbolized profile file.
3728 $symbols = ReadSymbols(*PROFILE{IO});
3729 # Read the next line to get the header for the remaining profile.
3730 $header = ReadProfileHeader(*PROFILE) || "";
3734 if ($header =~ m/^heap profile:.*$growth_marker/o) {
3736 $result = ReadHeapProfile($prog, *PROFILE, $header);
3737 } elsif ($header =~ m/^heap profile:/) {
3739 $result = ReadHeapProfile($prog, *PROFILE, $header);
3742 $result = ReadSynchProfile($prog, *PROFILE);
3745 "Old format contention profile: mistakenly reports " .
3748 $result = ReadSynchProfile($prog, *PROFILE);
3750 # the binary cpu profile data starts immediately after this line
3752 $result = ReadCPUProfile($prog, $fname, *PROFILE);
3755 # a symbolized profile contains a format we don't recognize, bail out
3756 error("$fname: Cannot recognize profile section after symbols.\n");
3758 # no ascii header present -- must be a CPU profile
3760 $result = ReadCPUProfile($prog, $fname, *PROFILE);
3763 close(PROFILE);
3765 # if we got symbols along with the profile, return those as well
3774 # However, don't do this if we're reading a symbolized profile
3800 # CPU profile reader
3804 local *PROFILE = shift;
3808 my $profile = {};
3812 my $slots = CpuProfileStream->new(*PROFILE, $fname);
3822 error("$fname: not a profile file, or old format profile file\n");
3829 error("$fname: not a profile file, or corrupted profile file\n");
3832 # Parse profile
3842 # End of profile data marker
3852 # However, don't do this if we're reading a symbolized profile
3863 AddEntry($profile, (join "\n", @k), $n);
3869 seek(PROFILE, $i * 4, 0);
3870 read(PROFILE, $map, (stat PROFILE)[7]);
3875 $r->{profile} = $profile;
3884 local *PROFILE = shift;
3898 # Find the type of this profile. The header line looks like:
3899 # heap profile: 1246: 8800744 [ 1246: 8800744] @ <heap-url>/266053
3901 # second allocated objects/space. This is followed optionally by a profile
3916 # heap profile: 1922: 127792360 [ 1922: 127792360] @ <heap-url>_v2/524288
3923 if ($header =~ m"^heap profile:\s*(\d+):\s+(\d+)\s+\[\s*(\d+):\s+(\d+)\](\s*@\s*([^/]*)(/(\d+))?)?") {
3948 # We detect whether or not this is a remote-heap profile by checking
3951 # that a non-remote-heap profile may pass this check, but it is hard
3956 # This is likely to be a remote-heap based sample profile
3966 # Turn on profile adjustment.
3979 my $profile = {};
3983 while (<PROFILE>) {
3987 while (<PROFILE>) {
3997 while (<PROFILE>) {
4055 AddEntries($profile, $pcs, FixCallerAddresses($stack), $counts[$index]);
4062 $r->{profile} = $profile;
4070 local *PROFILE = shift;
4074 my $profile = {};
4090 while ( $line = <PROFILE> ) {
4103 AddEntries($profile, $pcs, FixCallerAddresses($stack), $values[$index]);
4118 AddEntries($profile, $pcs, FixCallerAddresses($stack), $cycles);
4148 printf STDERR ("No cycles/second entry in profile; Guessing %.1f GHz\n",
4155 $r->{profile} = $profile;
4598 # Extract symbols for all PC values found in profile
4983 print STDERR "Dynamically gathered profile is in $main::collected_profile\n";
4985 print STDERR "If you want to investigate this profile further, you can do:\n";