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
0942fd55
Commit
0942fd55
authored
Feb 11, 2019
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add debug bit to count contended locks
Thank you to phk for the improvement over the initial suggestion
parent
5ec2db92
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
2 deletions
+35
-2
VSC_lck.vsc
bin/varnishd/VSC_lck.vsc
+22
-0
cache_lck.c
bin/varnishd/cache/cache_lck.c
+12
-2
debug_bits.h
include/tbl/debug_bits.h
+1
-0
No files found.
bin/varnishd/VSC_lck.vsc
View file @
0942fd55
...
...
@@ -30,5 +30,27 @@
:oneliner: Lock Operations
.. varnish_vsc:: dbg_busy
:type: counter
:level: debug
:oneliner: Contended lock operations
If the ``lck`` debug bit is set: Lock operations which
returned EBUSY on the first locking attempt.
If the ``lck`` debug bit is unset, this counter will never be
incremented even if lock operations are contended.
.. varnish_vsc:: dbg_try_fail
:type: counter
:level: debug
:oneliner: Contended trylock operations
If the ``lck`` debug bit is set: Trylock operations which
returned EBUSY.
If the ``lck`` debug bit is unset, this counter will never be
incremented even if lock operations are contended.
.. varnish_vsc_end:: lck
bin/varnishd/cache/cache_lck.c
View file @
0942fd55
...
...
@@ -107,11 +107,20 @@ void v_matchproto_()
Lck__Lock
(
struct
lock
*
lck
,
const
char
*
p
,
int
l
)
{
struct
ilck
*
ilck
;
int
r
=
EINVAL
;
CAST_OBJ_NOTNULL
(
ilck
,
lck
->
priv
,
ILCK_MAGIC
);
if
(
DO_DEBUG
(
DBG_WITNESS
))
Lck_Witness_Lock
(
ilck
,
p
,
l
,
""
);
AZ
(
pthread_mutex_lock
(
&
ilck
->
mtx
));
else
if
(
DO_DEBUG
(
DBG_LCK
))
{
r
=
pthread_mutex_trylock
(
&
ilck
->
mtx
);
if
(
r
==
EBUSY
)
ilck
->
stat
->
dbg_busy
++
;
else
AZ
(
r
);
}
if
(
r
)
AZ
(
pthread_mutex_lock
(
&
ilck
->
mtx
));
AZ
(
ilck
->
held
);
ilck
->
stat
->
locks
++
;
ilck
->
owner
=
pthread_self
();
...
...
@@ -162,7 +171,8 @@ Lck__Trylock(struct lock *lck, const char *p, int l)
ilck
->
held
=
1
;
ilck
->
stat
->
locks
++
;
ilck
->
owner
=
pthread_self
();
}
}
else
if
(
DO_DEBUG
(
DBG_LCK
))
ilck
->
stat
->
dbg_try_fail
++
;
return
(
r
);
}
...
...
include/tbl/debug_bits.h
View file @
0942fd55
...
...
@@ -51,6 +51,7 @@ DEBUG_BIT(VMOD_SO_KEEP, vmod_so_keep, "Keep copied VMOD libraries")
DEBUG_BIT
(
PROCESSORS
,
processors
,
"Fetch/Deliver processors"
)
DEBUG_BIT
(
PROTOCOL
,
protocol
,
"Protocol debugging"
)
DEBUG_BIT
(
VCL_KEEP
,
vcl_keep
,
"Keep VCL C and so files"
)
DEBUG_BIT
(
LCK
,
lck
,
"Additional lock statistics"
)
#undef DEBUG_BIT
/*lint -restore */
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