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"
103 my $PROFILE_PAGE = "/pprof/profile"; # must support cgi-param "?seconds=#"
150 <profiles> is a space separated list of profile names.
152 <symbolized-profiles> is a list of profile files where each file contains
153 the necessary symbol mappings as well as profile data (likely generated
155 jeprof [options] <profile>
156 <profile> is a remote form. Symbols are obtained from host:port$SYMBOL_PAGE
159 /path/to/profile - a path to a profile file
160 host:port[/<service>] - a location of a service to get profile from
171 and cpu-profile files (this loosely matches that of /proc/self/maps
181 --base=<base> Subtract <base> from <profile> before display
211 Heap-Profile Options:
219 Contention-profile options:
230 --thread=<n> Show profile for thread <n>
274 Fetches a remote profile for later analysis and then
380 # Type of profile we are dealing with
520 # Binary name and profile arguments list
530 $main::prog = $UNKNOWN_BINARY; # will be set later from the profile file
542 scalar(@ARGV) || usage("Did not specify profile file");
548 scalar(@ARGV) || usage("Did not specify profile file");
551 # Parse profile file/location arguments
567 error("The first profile should be a remote form to use $SYMBOL_PAGE\n");
591 my ($profile, $symbols, $libs, $thread) = @_;
593 # Get total data in profile
594 my $total = TotalProfile($profile);
597 $profile = RemoveUninterestingFrames($symbols, $profile);
601 $profile = FocusProfile($symbols, $profile, $main::opt_focus);
606 $profile = IgnoreProfile($symbols, $profile, $main::opt_ignore);
609 my $calls = ExtractCalls($symbols, $profile);
613 my $reduced = ReduceProfile($symbols, $profile);
636 PrintSymbolizedProfile($symbols, $profile, $main::prog);
638 PrintCollapsedStacks($symbols, $profile);
642 if (PrintDot($main::prog, $symbols, $profile, $flat, $cumulative, $total)) {
668 InteractiveMode($profile, $symbols, $libs, $total);
684 # Fetch all profile data
687 # this will hold symbols that we read from the profile files
690 # Read one profile, pick the last item on the list
692 my $profile = $data->{profile};
701 $profile = AddProfile($profile, $data2->{profile});
707 # Subtract base from profile, if specified
710 $profile = SubtractProfile($profile, $base->{profile});
730 FilterAndPrint($profile, $symbols, $libs);
862 # Takes two args: orig profile, and command to run.
896 my $profile = ProcessProfile($total, $orig_profile, $symbols, "", $ignore);
897 my $reduced = ReduceProfile($symbols, $profile);
931 my $profile = ProcessProfile($total, $orig_profile, $symbols, "", $ignore);
932 my $reduced = ReduceProfile($symbols, $profile);
948 # Process current profile to account for various settings
949 my $profile = ProcessProfile($total, $orig_profile, $symbols, "", $ignore);
950 my $reduced = ReduceProfile($symbols, $profile);
975 # Process current profile to account for various settings
976 my $profile = ProcessProfile($total, $orig_profile, $symbols,
978 my $reduced = ReduceProfile($symbols, $profile);
984 if (PrintDot($main::prog, $symbols, $profile, $flat, $cumulative, $total)) {
1011 # Process current profile to account for various settings
1012 my $profile = $orig_profile;
1015 $profile = FocusProfile($symbols, $profile, $focus);
1016 my $focus_count = TotalProfile($profile);
1023 $profile = IgnoreProfile($symbols, $profile, $ignore);
1024 my $ignore_count = TotalProfile($profile);
1032 return $profile;
1042 Show graphical hierarchical display of current profile. Without
1043 any arguments, shows all samples in the profile. With the optional
1050 Like GV, but displays profile in your web browser instead of using
1067 Show top lines ordered by flat profile count, or cumulative count
1125 # Print profile data in packed binary format (64-bit) to standard out
1127 my $profile = shift;
1133 foreach my $k (keys(%{$profile})) {
1134 my $count = $profile->{$k};
1147 print STDERR "Invalid address in profile: $full_addr\n";
1158 # Print symbols and profile data
1161 my $profile = shift;
1202 # if used with remote fetch, simply dump the collected profile to output.
1210 # would need to extend PrintProfileData() to handle all possible profile
1212 # and FixCallerAddresses(), and remove the remote profile dumping code in
1215 # dump a cpu-format profile to standard out
1216 PrintProfileData($profile);
1229 # Which profile to sort by?
1664 # density profile or just print all regions we find.
2772 ##### Profile manipulation code #####
2774 # Generate flattened 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};
2790 # Generate cumulative profile:
2791 # If count is charged to stack [a,b,c,d], in generated profile,
2794 my $profile = shift;
2796 foreach my $k (keys(%{$profile})) {
2797 my $count = $profile->{$k};
2809 my $profile = shift;
2812 foreach my $k (keys(%{$profile})) {
2881 my $profile = shift;
2884 while( my ($stack_trace, $count) = each %$profile ) {
2901 my $profile = shift;
2904 return $profile;
2908 foreach my $k (keys(%{$profile})) {
2909 my $count = $profile->{$k};
2938 my $profile = shift;
2940 while (my ($stack_trace, $count) = each %$profile) {
2949 my $profile = shift;
3033 # Drop signal handlers used for CPU profile collection
3055 while (my $second_pc = IsSecondPcAlwaysTheSame($profile)) {
3062 foreach my $k (keys(%{$profile})) {
3063 my $count = $profile->{$k};
3069 $profile = $result;
3074 foreach my $k (keys(%{$profile})) {
3075 my $count = $profile->{$k};
3100 # Reduce profile to granularity given by user
3103 my $profile = shift;
3107 foreach my $k (keys(%{$profile})) {
3108 my $count = $profile->{$k};
3144 my $profile = shift;
3147 foreach my $k (keys(%{$profile})) {
3148 my $count = $profile->{$k};
3164 my $profile = shift;
3167 foreach my $k (keys(%{$profile})) {
3168 my $count = $profile->{$k};
3185 # Get total count in profile
3187 my $profile = shift;
3189 foreach my $k (keys(%{$profile})) {
3190 $result += $profile->{$k};
3263 # Take care of when subtracted profile has more entries
3273 # Get entry from profile; zero if not present
3275 my $profile = shift;
3277 if (exists($profile->{$k})) {
3278 return $profile->{$k};
3284 # Add entry to specified profile
3286 my $profile = shift;
3289 if (!exists($profile->{$k})) {
3290 $profile->{$k} = 0;
3292 $profile->{$k} += $n;
3295 # Add a stack of entries to specified profile, and add them to the $pcs
3298 my $profile = shift;
3309 AddEntry($profile, (join "\n", @k), $count);
3312 ##### Code to profile a server dynamically #####
3350 # Split profile URL - matches all non-empty strings, so no test.
3356 my $profile = $4 || "/";
3362 return ($host, $baseurl, $profile);
3365 # We fetch symbols from the first profile argument.
3473 # Fetches and processes symbols to prepare them for use in the profile output
3475 # $SYMBOL_PAGE for all PC values found in profile. Otherwise, the raw symbols
3566 # Missing type specifier defaults to cpu-profile
3586 # the target profile file name.
3603 || die("Unable to create profile directory $profile_dir: $!\n");
3615 print STDERR "Gathering CPU profile from $url for $main::opt_seconds seconds to\n ${real_profile}\n";
3620 print STDERR "Fetching $path profile from $url to\n ${real_profile}\n";
3623 (system($cmd) == 0) || error("Failed to get profile: $cmd: $!\n");
3624 (system("mv", $tmp_profile, $real_profile) == 0) || error("Unable to rename profile\n");
3625 print STDERR "Wrote profile to $real_profile\n";
3672 # Collect a single profile
3690 # cpu-profile files. Stream in chunks along a sliding window.
3693 # (depending on the input profile). We tell endianness and bit-size
3694 # for the profile by looking at the first 8 bytes: in cpu profiles,
3706 perl_is_64bit => 1, # matters if profile is 64-bit
3730 # If we're a 64-bit profile, check if we're a 64-bit-capable
3782 ::error("Need a 64-bit perl to process this 64-bit profile.\n");
3800 print STDERR "Unexpected look-back reading CPU profile";
3813 # Reads the top, 'header' section of a profile, and returns the last
3815 # section of a profile consists of zero or more 'command' lines that
3818 # lines is the 'header line', which is a profile-specific line that
3819 # indicates what type of profile it is, and perhaps other global
3820 # information about the profile. For instance, here's a header line
3821 # for a heap profile:
3822 # heap profile: 53: 38236 [ 5525: 1284029] @ heapprofile
3823 # For historical reasons, the CPU profile does not contain a text-
3824 # readable header line. If the profile looks like a CPU profile,
3833 local *PROFILE = shift;
3836 read(PROFILE, $firstchar, 1);
3837 seek(PROFILE, -1, 1); # unread the firstchar
3841 while (defined($line = <PROFILE>)) {
3847 print STDERR "Ignoring unknown command from profile header: $line";
3874 # Parse profile generated by common/profiler.cc and return a reference
3876 # $result->{version} Version number of profile file
3878 # $result->{profile} Profile object
3879 # $result->{threads} Map of thread IDs to profile objects
3880 # $result->{map} Memory map info from profile
3898 # Look at first line to see if it is a heap or a CPU profile.
3899 # CPU profile may start with no header at all, and just binary data
3902 open(PROFILE, "<$fname") || error("$fname: $!\n");
3903 binmode PROFILE; # New perls do UTF-8 processing
3904 my $header = ReadProfileHeader(*PROFILE);
3906 error("Profile is empty.\n");
3911 # Verify that the user asked for a symbolized profile
3914 error("FATAL ERROR: Symbolized profile\n $fname\ncannot be used with " .
3917 # Read the symbol section of the symbolized profile file.
3918 $symbols = ReadSymbols(*PROFILE{IO});
3919 # Read the next line to get the header for the remaining profile.
3920 $header = ReadProfileHeader(*PROFILE) || "";
3924 # Skip "--- ..." line for profile types that have their own headers.
3925 $header = ReadProfileHeader(*PROFILE) || "";
3930 if ($header =~ m/^heap profile:.*$growth_marker/o) {
3932 $result = ReadHeapProfile($prog, *PROFILE, $header);
3933 } elsif ($header =~ m/^heap profile:/) {
3935 $result = ReadHeapProfile($prog, *PROFILE, $header);
3941 $result = ReadSynchProfile($prog, *PROFILE);
3944 "Old format contention profile: mistakenly reports " .
3947 $result = ReadSynchProfile($prog, *PROFILE);
3949 # the binary cpu profile data starts immediately after this line
3951 $result = ReadCPUProfile($prog, $fname, *PROFILE);
3954 # a symbolized profile contains a format we don't recognize, bail out
3955 error("$fname: Cannot recognize profile section after symbols.\n");
3957 # no ascii header present -- must be a CPU profile
3959 $result = ReadCPUProfile($prog, $fname, *PROFILE);
3962 close(PROFILE);
3964 # if we got symbols along with the profile, return those as well
3973 # However, don't do this if we're reading a symbolized profile
3999 # CPU profile reader
4003 local *PROFILE = shift;
4007 my $profile = {};
4011 my $slots = CpuProfileStream->new(*PROFILE, $fname);
4021 error("$fname: not a profile file, or old format profile file\n");
4028 error("$fname: not a profile file, or corrupted profile file\n");
4031 # Parse profile
4041 # End of profile data marker
4057 AddEntry($profile, (join "\n", @k), $n);
4063 seek(PROFILE, $i * 4, 0);
4064 read(PROFILE, $map, (stat PROFILE)[7]);
4069 $r->{profile} = $profile;
4106 while (<PROFILE>) {
4161 local *PROFILE = shift;
4166 # Find the type of this profile. The header line looks like:
4167 # heap profile: 1246: 8800744 [ 1246: 8800744] @ <heap-url>/266053
4169 # second allocated objects/space. This is followed optionally by a profile
4184 # heap profile: 1922: 127792360 [ 1922: 127792360] @ <heap-url>_v2/524288
4191 if ($header =~ m"^heap profile:\s*(\d+):\s+(\d+)\s+\[\s*(\d+):\s+(\d+)\](\s*@\s*([^/]*)(/(\d+))?)?") {
4216 # We detect whether or not this is a remote-heap profile by checking
4219 # that a non-remote-heap profile may pass this check, but it is hard
4224 # This is likely to be a remote-heap based sample profile
4234 # Turn on profile adjustment.
4247 my $profile = {};
4251 while (<PROFILE>) {
4254 $map .= ReadMappedLibraries(*PROFILE);
4259 $map .= ReadMemoryMap(*PROFILE);
4272 AddEntries($profile, $pcs, FixCallerAddresses($stack), $counts[$index]);
4279 $r->{profile} = $profile;
4303 my $profile = {};
4309 while (<PROFILE>) {
4312 $map .= ReadMappedLibraries(*PROFILE);
4317 $map .= ReadMemoryMap(*PROFILE);
4341 AddEntries($profile, $pcs, FixCallerAddresses($stack), $counts[$index]);
4355 $r->{profile} = $profile;
4364 local *PROFILE = shift;
4368 my $profile = {};
4384 while ( $line = <PROFILE> ) {
4397 AddEntries($profile, $pcs, FixCallerAddresses($stack), $values[$index]);
4412 AddEntries($profile, $pcs, FixCallerAddresses($stack), $cycles);
4442 printf STDERR ("No cycles/second entry in profile; Guessing %.1f GHz\n",
4449 $r->{profile} = $profile;
4940 # Extract symbols for all PC values found in profile
5325 print STDERR "Dynamically gathered profile is in $main::collected_profile\n";
5327 print STDERR "If you want to investigate this profile further, you can do:\n";