From 3e932d8aa88ec18bd89770d170978e699c25a9a0 Mon Sep 17 00:00:00 2001 From: "agentzh (Yichun Zhang)" Date: Tue, 21 Aug 2012 18:22:48 -0700 Subject: [PATCH] updated the dtrace patch for nginx 1.2.3 and 1.3.4. --- patches/nginx-1.2.3-dtrace.patch | 51 ++++++++++++++++++++++++++++++-- patches/nginx-1.3.4-dtrace.patch | 51 ++++++++++++++++++++++++++++++-- 2 files changed, 98 insertions(+), 4 deletions(-) diff --git a/patches/nginx-1.2.3-dtrace.patch b/patches/nginx-1.2.3-dtrace.patch index baf7ca5..e34b8da 100644 --- a/patches/nginx-1.2.3-dtrace.patch +++ b/patches/nginx-1.2.3-dtrace.patch @@ -391,10 +391,10 @@ index 45ea154..332c011 100755 echo "checking for OS" diff --git a/src/dtrace/nginx.stp b/src/dtrace/nginx.stp new file mode 100644 -index 0000000..fccea2b +index 0000000..3dde1be --- /dev/null +++ b/src/dtrace/nginx.stp -@@ -0,0 +1,152 @@ +@@ -0,0 +1,199 @@ +/* tapset for nginx */ + +/* retrieve the request uri string from the ngx_http_request_t pointer */ @@ -448,6 +448,12 @@ index 0000000..fccea2b +} + + ++function ngx_chain_next(cl) ++{ ++ return @cast(cl, "ngx_chain_t", "NGX_SBIN_PATH")->next ++} ++ ++ +function ngx_buf_in_memory(b) +{ + return @cast(b, "ngx_buf_t", "NGX_SBIN_PATH")->temporary @@ -502,6 +508,32 @@ index 0000000..fccea2b +} + + ++function ngx_chain_writer_ctx_out(ctx) ++{ ++ return @cast(c, "ngx_chain_writer_ctx_t", "NGX_SBIN_PATH")->out ++} ++ ++ ++function ngx_chain_dump:string (input) ++{ ++ if (input == 0) { ++ return "NULL" ++ } ++ ++ out = "" ++ cl = input ++ while (cl) { ++ buf = ngx_chain_buf(cl) ++ out .= sprintf("[%s]", text_str(ngx_buf_data(buf))) ++ cl = ngx_chain_next(cl) ++ if (cl) { ++ out .= sprintf(" ") ++ } ++ } ++ return out ++} ++ ++ +function ngx_pool_cleanup_file_name(c) +{ + return user_string(@cast(c, "ngx_pool_cleanup_file_t", "NGX_SBIN_PATH")->name) @@ -547,6 +579,21 @@ index 0000000..fccea2b + return user_string_n(@cast(e, "ngx_table_elt_t", "NGX_SBIN_PATH")->value->data, len) +} + ++ ++function ngx_iovec_dump:string (iov, iovcnt) { ++ out = "" ++ for (i = 0; i < iovcnt; i++) { ++ out .= sprintf("\"%s\"(%p)", text_str(user_string_n( ++ @cast(iov, "struct iovec")[i]->iov_base, ++ @cast(iov, "struct iovec")[i]->iov_len) ++ ), @cast(iov, "struct iovec")[i]->iov_base) ++ if (i != iovcnt - 1) { ++ out .= " " ++ } ++ } ++ return out ++} ++ diff --git a/src/dtrace/nginx_provider.d b/src/dtrace/nginx_provider.d new file mode 100644 index 0000000..7f93101 diff --git a/patches/nginx-1.3.4-dtrace.patch b/patches/nginx-1.3.4-dtrace.patch index baf7ca5..e34b8da 100644 --- a/patches/nginx-1.3.4-dtrace.patch +++ b/patches/nginx-1.3.4-dtrace.patch @@ -391,10 +391,10 @@ index 45ea154..332c011 100755 echo "checking for OS" diff --git a/src/dtrace/nginx.stp b/src/dtrace/nginx.stp new file mode 100644 -index 0000000..fccea2b +index 0000000..3dde1be --- /dev/null +++ b/src/dtrace/nginx.stp -@@ -0,0 +1,152 @@ +@@ -0,0 +1,199 @@ +/* tapset for nginx */ + +/* retrieve the request uri string from the ngx_http_request_t pointer */ @@ -448,6 +448,12 @@ index 0000000..fccea2b +} + + ++function ngx_chain_next(cl) ++{ ++ return @cast(cl, "ngx_chain_t", "NGX_SBIN_PATH")->next ++} ++ ++ +function ngx_buf_in_memory(b) +{ + return @cast(b, "ngx_buf_t", "NGX_SBIN_PATH")->temporary @@ -502,6 +508,32 @@ index 0000000..fccea2b +} + + ++function ngx_chain_writer_ctx_out(ctx) ++{ ++ return @cast(c, "ngx_chain_writer_ctx_t", "NGX_SBIN_PATH")->out ++} ++ ++ ++function ngx_chain_dump:string (input) ++{ ++ if (input == 0) { ++ return "NULL" ++ } ++ ++ out = "" ++ cl = input ++ while (cl) { ++ buf = ngx_chain_buf(cl) ++ out .= sprintf("[%s]", text_str(ngx_buf_data(buf))) ++ cl = ngx_chain_next(cl) ++ if (cl) { ++ out .= sprintf(" ") ++ } ++ } ++ return out ++} ++ ++ +function ngx_pool_cleanup_file_name(c) +{ + return user_string(@cast(c, "ngx_pool_cleanup_file_t", "NGX_SBIN_PATH")->name) @@ -547,6 +579,21 @@ index 0000000..fccea2b + return user_string_n(@cast(e, "ngx_table_elt_t", "NGX_SBIN_PATH")->value->data, len) +} + ++ ++function ngx_iovec_dump:string (iov, iovcnt) { ++ out = "" ++ for (i = 0; i < iovcnt; i++) { ++ out .= sprintf("\"%s\"(%p)", text_str(user_string_n( ++ @cast(iov, "struct iovec")[i]->iov_base, ++ @cast(iov, "struct iovec")[i]->iov_len) ++ ), @cast(iov, "struct iovec")[i]->iov_base) ++ if (i != iovcnt - 1) { ++ out .= " " ++ } ++ } ++ return out ++} ++ diff --git a/src/dtrace/nginx_provider.d b/src/dtrace/nginx_provider.d new file mode 100644 index 0000000..7f93101