Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ nginx
*.svg
*.bt
*.cbt
.idea/*
8 changes: 3 additions & 5 deletions accessed-files
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ probe end {
printf("\\n=== Top $limit file $operation ===\\n")

i = 0
foreach (path in stats- limit $limit) {
foreach (pathname in stats- limit $limit) {
printf("#%d: %d times, %d bytes $operation in file %s.\\n",
++i, \@count(stats[path]), \@sum(stats[path]), path)
++i, \@count(stats[pathname]), \@sum(stats[pathname]), pathname)
}
}
}
Expand Down Expand Up @@ -114,9 +114,7 @@ $preamble

probe $probes {
if (pid() == target() && \$return > 0) {
path = __file_filename(file)
//println(path)
stats[path] <<< \$return
stats[pathname] <<< \$return
found++;
}
}
Expand Down
2 changes: 2 additions & 0 deletions check-debug-info
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ my $pid = $opts{p}
or die "No -p <pid> option specified.\n";

my $exec_file = "/proc/$pid/exe";

if (!-f $exec_file) {
die "User process $pid is not running or ",
"you do not have enough permissions.\n";
Expand Down Expand Up @@ -41,6 +42,7 @@ my %files = ($path => 1);
}

for my $file (sort keys %files) {
$file = "/proc/$pid/root" . $file;
my $lines = `objdump --dwarf=str $file|wc -l`;
if ($? != 0) {
warn "Failed to check file $file: $?\n";
Expand Down
25 changes: 20 additions & 5 deletions ngx-active-reqs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ if (!-f $exec_file) {
"you do not have enough permissions.\n";
}

my $nginx_path = readlink $exec_file;
my $nginx_path = "/proc/$pid/root" . readlink $exec_file;

my $ver = `stap --version 2>&1`;
if (!defined $ver) {
Expand Down Expand Up @@ -96,10 +96,26 @@ my $p = '@cast(p, "ngx_event_pipe_t")';

my $need_blank_line;

my ($check_upstream_code, $check_pool_init_code, $check_pool_code);
my ($check_upstream_code, $check_pool_init_code, $check_pool_code, $keep_waiting_code);

my $fin_code = '';

if ($keep_waiting) {
$keep_waiting_code = <<_EOC_;
_EOC_

}else{

$keep_waiting_code = <<_EOC_;
if (nreqs) {
exit()
}
_EOC_

}

chop $keep_waiting_code;

if ($check_upstreams) {
$need_blank_line = 1;

Expand Down Expand Up @@ -428,9 +444,8 @@ $fin_code

elapsed = local_clock_us() - begin
printf("%d microseconds elapsed in the probe handler.\\n", elapsed)
if (nreqs || !$keep_waiting) {
exit()
}
$keep_waiting_code

} /* $condition */
}
_EOC_
Expand Down
2 changes: 0 additions & 2 deletions ngx-backtrace
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ if (!-f $exec_file) {
"you do not have enough permissions.\n";
}

my $nginx_path = readlink $exec_file;

exec 'addr2line', '-e', $exec_file, '-f', @ARGV;

sub usage {
Expand Down
2 changes: 1 addition & 1 deletion ngx-body-filters
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if (!-f $exec_file) {
"you do not have enough permissions.\n";
}

my $nginx_path = readlink $exec_file;
my $nginx_path = "/proc/$pid/root" . readlink $exec_file;

my $ver = `stap --version 2>&1`;
if (!defined $ver) {
Expand Down
2 changes: 1 addition & 1 deletion ngx-cycle-pool
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if (!-f $exec_file) {
"you do not have enough permissions.\n";
}

my $nginx_path = readlink $exec_file;
my $nginx_path = "/proc/$pid/root" . readlink $exec_file;

my $ver = `stap --version 2>&1`;
if (!defined $ver) {
Expand Down
3 changes: 2 additions & 1 deletion ngx-header-filters
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ if (!-f $exec_file) {
"you do not have enough permissions.\n";
}

my $nginx_path = readlink $exec_file;

my $nginx_path = "/proc/$pid/root" . readlink $exec_file;

my $ver = `stap --version 2>&1`;
if (!defined $ver) {
Expand Down
2 changes: 1 addition & 1 deletion ngx-leaked-pools
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ if (!-f $exec_file) {
"you do not have enough permissions.\n";
}

my $nginx_path = readlink $exec_file;
my $nginx_path = "/proc/$pid/root" . readlink $exec_file;

my $ver = `stap --version 2>&1`;
if (!defined $ver) {
Expand Down
2 changes: 1 addition & 1 deletion ngx-pcrejit
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if (!-f $exec_file) {
"you do not have enough permissions.\n";
}

my $nginx_path = readlink $exec_file;
my $nginx_path = "/proc/$pid/root" . readlink $exec_file;

my $maps_file = "/proc/$pid/maps";
if (!-f $maps_file) {
Expand Down
2 changes: 1 addition & 1 deletion ngx-req-distr
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if (!-f $exec_file) {
"you do not have enough permissions.\n";
}

my $nginx_path = readlink $exec_file;
my $nginx_path = "/proc/$master_pid/root" . readlink $exec_file;

my $ver = `stap --version 2>&1`;
if (!defined $ver) {
Expand Down
Loading