Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
73632b2c
Commit
73632b2c
authored
Aug 27, 2012
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a debug parameter and start moving diag_bitmap stuff into it.
XXX: doc-update needed
parent
9232cd63
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
105 additions
and
11 deletions
+105
-11
cache.h
bin/varnishd/cache/cache.h
+13
-6
cache_req_fsm.c
bin/varnishd/cache/cache_req_fsm.c
+1
-1
params.h
bin/varnishd/common/params.h
+9
-1
mgt_param.c
bin/varnishd/mgt/mgt_param.c
+0
-1
mgt_param_bits.c
bin/varnishd/mgt/mgt_param_bits.c
+47
-0
t00000.vtc
bin/varnishtest/tests.disabled/t00000.vtc
+1
-1
r00902.vtc
bin/varnishtest/tests/r00902.vtc
+1
-1
Makefile.am
include/Makefile.am
+1
-0
debug_bits.h
include/tbl/debug_bits.h
+32
-0
No files found.
bin/varnishd/cache/cache.h
View file @
73632b2c
...
@@ -976,12 +976,6 @@ void VSLbt(struct vsl_log *, enum VSL_tag_e tag, txt t);
...
@@ -976,12 +976,6 @@ void VSLbt(struct vsl_log *, enum VSL_tag_e tag, txt t);
void
VSL_Flush
(
struct
vsl_log
*
,
int
overflow
);
void
VSL_Flush
(
struct
vsl_log
*
,
int
overflow
);
#define DSL(flag, tag, id, ...) \
do { \
if (cache_param->diag_bitmap & (flag)) \
VSL((tag), (id), __VA_ARGS__); \
} while (0)
#endif
#endif
/* cache_response.c */
/* cache_response.c */
...
@@ -1122,3 +1116,16 @@ Tadd(txt *t, const char *p, int l)
...
@@ -1122,3 +1116,16 @@ Tadd(txt *t, const char *p, int l)
* extra timestamps in cache_pool.c. Hide this detail with a macro
* extra timestamps in cache_pool.c. Hide this detail with a macro
*/
*/
#define W_TIM_real(w) ((w)->lastused = VTIM_real())
#define W_TIM_real(w) ((w)->lastused = VTIM_real())
static
inline
int
DO_DEBUG
(
enum
debug_bits
x
)
{
return
(
cache_param
->
debug_bits
[(
unsigned
)
x
>>
3
]
&
(
0x80U
>>
((
unsigned
)
x
&
7
)));
}
#define DSL(flag, tag, id, ...) \
do { \
if (cache_param->diag_bitmap & (flag)) \
VSL((tag), (id), __VA_ARGS__); \
} while (0)
bin/varnishd/cache/cache_req_fsm.c
View file @
73632b2c
...
@@ -1220,7 +1220,7 @@ CNT_Request(struct worker *wrk, struct req *req)
...
@@ -1220,7 +1220,7 @@ CNT_Request(struct worker *wrk, struct req *req)
switch
(
req
->
req_step
)
{
switch
(
req
->
req_step
)
{
#define REQ_STEP(l,u,arg) \
#define REQ_STEP(l,u,arg) \
case R_STP_##u: \
case R_STP_##u: \
if (
cache_param->diag_bitmap & 0x01
) \
if (
DO_DEBUG(DBG_REQ_STATE)
) \
cnt_diag(req, #u); \
cnt_diag(req, #u); \
done = cnt_##l arg; \
done = cnt_##l arg; \
break;
break;
...
...
bin/varnishd/common/params.h
View file @
73632b2c
...
@@ -33,6 +33,13 @@
...
@@ -33,6 +33,13 @@
#define VSM_CLASS_PARAM "Params"
#define VSM_CLASS_PARAM "Params"
enum
debug_bits
{
#define DEBUG_BIT(U, l, p, d) DBG_##U,
#include "tbl/debug_bits.h"
#undef DEBUG_BIT
DBG_Reserved
};
struct
poolparam
{
struct
poolparam
{
unsigned
min_pool
;
unsigned
min_pool
;
unsigned
max_pool
;
unsigned
max_pool
;
...
@@ -198,5 +205,6 @@ struct params {
...
@@ -198,5 +205,6 @@ struct params {
struct
poolparam
sess_pool
;
struct
poolparam
sess_pool
;
struct
poolparam
vbo_pool
;
struct
poolparam
vbo_pool
;
uint8_t
vsl_mask
[
256
/
8
];
uint8_t
vsl_mask
[
256
>>
3
];
uint8_t
debug_bits
[(
DBG_Reserved
+
7
)
>>
3
];
};
};
bin/varnishd/mgt/mgt_param.c
View file @
73632b2c
...
@@ -1046,7 +1046,6 @@ static const struct parspec input_parspec[] = {
...
@@ -1046,7 +1046,6 @@ static const struct parspec input_parspec[] = {
WAITER_DEFAULT
,
NULL
},
WAITER_DEFAULT
,
NULL
},
{
"diag_bitmap"
,
tweak_diag_bitmap
,
0
,
0
,
0
,
{
"diag_bitmap"
,
tweak_diag_bitmap
,
0
,
0
,
0
,
"Bitmap controlling diagnostics code:
\n
"
"Bitmap controlling diagnostics code:
\n
"
" 0x00000001 - CNT_Session states.
\n
"
" 0x00000002 - workspace debugging.
\n
"
" 0x00000002 - workspace debugging.
\n
"
" 0x00000004 - kqueue debugging.
\n
"
" 0x00000004 - kqueue debugging.
\n
"
" 0x00000008 - mutex logging.
\n
"
" 0x00000008 - mutex logging.
\n
"
...
...
bin/varnishd/mgt/mgt_param_bits.c
View file @
73632b2c
...
@@ -153,6 +153,45 @@ tweak_vsl_mask(struct cli *cli, const struct parspec *par, const char *arg)
...
@@ -153,6 +153,45 @@ tweak_vsl_mask(struct cli *cli, const struct parspec *par, const char *arg)
}
}
}
}
/*--------------------------------------------------------------------
* The debug parameter
*/
static
const
char
*
const
debug_tags
[]
=
{
# define DEBUG_BIT(U,l,p,d) [DBG_##U] = #l,
# include "tbl/debug_bits.h"
# undef DEBUG_BIT
NULL
};
static
void
tweak_debug
(
struct
cli
*
cli
,
const
struct
parspec
*
par
,
const
char
*
arg
)
{
const
char
*
s
;
unsigned
j
;
(
void
)
par
;
if
(
arg
!=
NULL
)
{
if
(
!
strcmp
(
arg
,
"none"
))
{
memset
(
mgt_param
.
debug_bits
,
0
,
sizeof
mgt_param
.
debug_bits
);
}
else
{
bit_tweak
(
cli
,
mgt_param
.
debug_bits
,
DBG_Reserved
,
arg
,
debug_tags
,
"debug bit"
,
"+"
);
}
}
else
{
s
=
""
;
for
(
j
=
0
;
j
<
(
unsigned
)
DBG_Reserved
;
j
++
)
{
if
(
bit
(
mgt_param
.
debug_bits
,
j
,
BTST
))
{
VCLI_Out
(
cli
,
"%s+%s"
,
s
,
debug_tags
[
j
]);
s
=
","
;
}
}
if
(
*
s
==
'\0'
)
VCLI_Out
(
cli
,
"none"
);
}
}
/*--------------------------------------------------------------------
/*--------------------------------------------------------------------
* The parameter table itself
* The parameter table itself
*/
*/
...
@@ -164,5 +203,13 @@ const struct parspec VSL_parspec[] = {
...
@@ -164,5 +203,13 @@ const struct parspec VSL_parspec[] = {
"Use +/- prefixe in front of VSL tag name, to mask/unmask "
"Use +/- prefixe in front of VSL tag name, to mask/unmask "
"individual VSL messages."
,
"individual VSL messages."
,
0
,
"default"
,
""
},
0
,
"default"
,
""
},
{
"debug"
,
tweak_debug
,
NULL
,
0
,
0
,
"Enable/Disable various kinds of debugging.
\n
"
"
\t
none
\t\t
Disable all debugging
\n
"
"Use +/- prefix to set/reset individual bits:
\n
"
#define DEBUG_BIT(U, l, p, d) "\t" #l "\t" p d "\n"
#include "tbl/debug_bits.h"
#undef DEBUG_BIT
,
0
,
"none"
,
""
},
{
NULL
,
NULL
,
NULL
}
{
NULL
,
NULL
,
NULL
}
};
};
bin/varnishtest/tests.disabled/t00000.vtc
View file @
73632b2c
...
@@ -20,7 +20,7 @@ varnish v1 -vcl+backend {
...
@@ -20,7 +20,7 @@ varnish v1 -vcl+backend {
}
}
} -start
} -start
varnish v1 -cliok "param.set d
iag_bitmap 1
"
varnish v1 -cliok "param.set d
ebug +req_state
"
client c1 {
client c1 {
txreq -hdr "foo: /foo"
txreq -hdr "foo: /foo"
...
...
bin/varnishtest/tests/r00902.vtc
View file @
73632b2c
...
@@ -15,7 +15,7 @@ server s1 {
...
@@ -15,7 +15,7 @@ server s1 {
varnish v1 -vcl+backend {
varnish v1 -vcl+backend {
} -start
} -start
varnish v1 -cliok "param.set d
iag_bitmap 1
"
varnish v1 -cliok "param.set d
ebug +req_state
"
client c1 {
client c1 {
txreq -hdr "foo: /foo"
txreq -hdr "foo: /foo"
...
...
include/Makefile.am
View file @
73632b2c
...
@@ -6,6 +6,7 @@ nobase_pkginclude_HEADERS = \
...
@@ -6,6 +6,7 @@ nobase_pkginclude_HEADERS = \
tbl/backend_poll.h
\
tbl/backend_poll.h
\
tbl/ban_vars.h
\
tbl/ban_vars.h
\
tbl/body_status.h
\
tbl/body_status.h
\
tbl/debug_bits.h
\
tbl/http_headers.h
\
tbl/http_headers.h
\
tbl/http_response.h
\
tbl/http_response.h
\
tbl/locks.h
\
tbl/locks.h
\
...
...
include/tbl/debug_bits.h
0 → 100644
View file @
73632b2c
/*-
* Copyright (c) 2012 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Fields in the debug parameter
*
*/
DEBUG_BIT
(
REQ_STATE
,
req_state
,
""
,
"Request state engine"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment