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
7a39df30
Commit
7a39df30
authored
Sep 13, 2016
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a '-vsc' which dumps a set of counters using a 'glob' pattern
parent
0667b98c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
0 deletions
+74
-0
vtc_varnish.c
bin/varnishtest/vtc_varnish.c
+74
-0
No files found.
bin/varnishtest/vtc_varnish.c
View file @
7a39df30
...
...
@@ -35,6 +35,7 @@
#include <errno.h>
#include <fcntl.h>
#include <fnmatch.h>
#include <inttypes.h>
#include <poll.h>
#include <stdio.h>
...
...
@@ -790,6 +791,64 @@ varnish_vclbackend(struct varnish *v, const char *vcl)
VSB_destroy
(
&
vsb2
);
}
/**********************************************************************
*/
struct
dump_priv
{
const
char
*
arg
;
const
struct
varnish
*
v
;
};
static
int
do_stat_dump_cb
(
void
*
priv
,
const
struct
VSC_point
*
const
pt
)
{
const
struct
varnish
*
v
;
struct
dump_priv
*
dp
;
uint64_t
u
;
char
buf
[
1024
];
if
(
pt
==
NULL
)
return
(
0
);
dp
=
priv
;
v
=
dp
->
v
;
if
(
strcmp
(
pt
->
desc
->
ctype
,
"uint64_t"
))
return
(
0
);
u
=
*
(
const
volatile
uint64_t
*
)
pt
->
ptr
;
strcpy
(
buf
,
pt
->
section
->
type
);
if
(
pt
->
section
->
ident
[
0
]
!=
'\0'
)
{
strcat
(
buf
,
"."
);
strcat
(
buf
,
pt
->
section
->
ident
);
}
strcat
(
buf
,
"."
);
strcat
(
buf
,
pt
->
desc
->
name
);
if
(
strcmp
(
dp
->
arg
,
"*"
))
{
if
(
fnmatch
(
dp
->
arg
,
buf
,
0
))
return
(
0
);
}
vtc_log
(
v
->
vl
,
4
,
"VSC %s %ju"
,
buf
,
u
);
return
(
0
);
}
static
void
varnish_vsc
(
const
struct
varnish
*
v
,
const
char
*
arg
)
{
struct
dump_priv
dp
;
memset
(
&
dp
,
0
,
sizeof
dp
);
dp
.
v
=
v
;
dp
.
arg
=
arg
;
if
(
VSM_Abandoned
(
v
->
vd
))
{
VSM_Close
(
v
->
vd
);
VSM_Open
(
v
->
vd
);
}
(
void
)
VSC_Iter
(
v
->
vd
,
NULL
,
do_stat_dump_cb
,
&
dp
);
}
/**********************************************************************
* Check statistics
*/
...
...
@@ -822,6 +881,9 @@ do_stat_cb(void *priv, const struct VSC_point * const pt)
return
(
1
);
}
/**********************************************************************
*/
static
void
varnish_expect
(
const
struct
varnish
*
v
,
char
*
const
*
av
)
{
...
...
@@ -1001,6 +1063,12 @@ varnish_expect(const struct varnish *v, char * const *av)
* a correct value. OP can be ==, >, >=, <, <=. For example::
*
* varnish v1 -expect SMA.s1.g_space > 1000000
*
* \-vsc PATTERN
* Dump VSC counters matching PATTERN. The PATTERN is a 'glob'
* style pattern (ie: fnmatch(3)) as used in shell filename expansion.
* To see all counters use pattern "*", to see all counters about
* requests use "*req*".
*/
void
...
...
@@ -1131,6 +1199,12 @@ cmd_varnish(CMD_ARGS)
av
++
;
continue
;
}
if
(
!
strcmp
(
*
av
,
"-vsc"
))
{
AN
(
av
[
1
]);
varnish_vsc
(
v
,
av
[
1
]);
av
++
;
continue
;
}
if
(
!
strcmp
(
*
av
,
"-wait-stopped"
))
{
wait_stopped
(
v
);
continue
;
...
...
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