piotrsikora / ngx_trace Goto Github PK
View Code? Open in Web Editor NEWThis project forked from zzzcpan/ngx_trace
runtime call tracer for nginx
This project forked from zzzcpan/ngx_trace
runtime call tracer for nginx
NAME tracerx.pl - runtime call tracer for nginx DESCRIPTION Simple runtime call tracer. Uses profiling instrument functions and symbol table to record and print calls. Useful for complex problems and learning nginx internals. Something similar can be done with gdb and lots of breakpoints, but annoyingly slowly. INSTALLATION Download and compile nginx with "ngx_trace" module: % ./configure --add-module=/path/to/ngx_trace && make This will enable debug symbols and instrument functions for gcc. Next, make sure binary works and can print its own version: % ./objs/nginx -V Prepare environment to run nginx from: % mkdir mynginx % mkdir mynginx/logs % cp -r conf mynginx/ % cp -r html mynginx/ Edit your new "nginx.conf", make sure it runs single process in foreground and uses ports that don't require privileges to bind to: daemon off; master_process off; ... http { server { listen 5678; ... I find it useful to print errors to stderr as well: error_log /dev/stderr debug; And now you can start playing with tracerx.pl: % /path/to/ngx_trace/tracerx.pl ./objs/nginx -p mynginx More useful: prints filename, line number, calls within http, event modules, ngx_connection.c and ignores access.log messages: % ./tracerx.pl -l -f 'core/ngx_conn|http/|event/' \ -i 'get_indexed_variable|_log_' \ ./objs/nginx -p mynginx SYNOPSIS tracerx.pl [OPTIONS] COMMAND [ARGS] OPTIONS -l print filename, line number saved from "nm -l" and time offset -s PATTERN print calls matching specified regex pattern only -i PATTERN ignore calls matching regex pattern -f PATTERN print calls if filename matches pattern -t show how much time it took to run each function in microseconds -u show addresses of unknown functions EXAMPLES Show all calls within src/http and src/event modules: % ./tracerx.pl -f 'src/http|src/event' ./objs/nginx -p mynginx Show calls within http and ignore all calls containing _log_ in function name: % ./tracerx.pl -f 'src/http' -i '_log_' ./objs/nginx -p mynginx AUTHOR Alexandr Gomoliako <[email protected]> LICENSE Copyright 2011 Alexandr Gomoliako. All rights reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.