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
47106ec3
Commit
47106ec3
authored
May 24, 2017
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Retire the VSC_Mgt() and VSC_Main() functions.
parent
98be9d5e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
67 deletions
+61
-67
cache_shmlog.c
bin/varnishd/cache/cache_shmlog.c
+0
-1
varnishstat.c
bin/varnishstat/varnishstat.c
+22
-4
varnishstat_curses.c
bin/varnishstat/varnishstat_curses.c
+39
-21
vsc.h
include/vapi/vsc.h
+0
-23
vsc.c
lib/libvarnishapi/vsc.c
+0
-18
No files found.
bin/varnishd/cache/cache_shmlog.c
View file @
47106ec3
...
...
@@ -533,7 +533,6 @@ VSC_Destroy(const char *nm, const void *p)
VTAILQ_REMOVE
(
&
vsc_seglist
,
vsg
,
list
);
FREE_OBJ
(
vsg
);
return
;
}
WRONG
(
"Freeing unknown VSC"
);
}
...
...
bin/varnishstat/varnishstat.c
View file @
47106ec3
...
...
@@ -165,6 +165,25 @@ struct once_priv {
int
pad
;
};
static
int
do_once_cb_first
(
void
*
priv
,
const
struct
VSC_point
*
const
pt
)
{
struct
once_priv
*
op
;
uint64_t
val
;
const
struct
VSC_section
*
sec
;
if
(
pt
==
NULL
)
return
(
0
);
op
=
priv
;
AZ
(
strcmp
(
pt
->
desc
->
ctype
,
"uint64_t"
));
sec
=
pt
->
section
;
if
(
strcmp
(
sec
->
type
,
"MAIN"
)
||
strcmp
(
pt
->
desc
->
name
,
"uptime"
))
return
(
0
);
val
=
*
(
const
volatile
uint64_t
*
)
pt
->
ptr
;
op
->
up
=
(
double
)
val
;
return
(
1
);
}
static
int
do_once_cb
(
void
*
priv
,
const
struct
VSC_point
*
const
pt
)
{
...
...
@@ -199,15 +218,14 @@ do_once_cb(void *priv, const struct VSC_point * const pt)
}
static
void
do_once
(
struct
VSM_data
*
vd
,
const
struct
VSC_C_main
*
VSC_C_main
)
do_once
(
struct
VSM_data
*
vd
)
{
struct
once_priv
op
;
memset
(
&
op
,
0
,
sizeof
op
);
if
(
VSC_C_main
!=
NULL
)
op
.
up
=
VSC_C_main
->
uptime
;
op
.
pad
=
18
;
(
void
)
VSC_Iter
(
vd
,
NULL
,
do_once_cb_first
,
&
op
);
(
void
)
VSC_Iter
(
vd
,
NULL
,
do_once_cb
,
&
op
);
}
...
...
@@ -352,7 +370,7 @@ main(int argc, char * const *argv)
else
if
(
json
)
do_json
(
vd
);
else
if
(
once
)
do_once
(
vd
,
VSC_Main
(
vd
,
NULL
)
);
do_once
(
vd
);
else
if
(
f_list
)
list_fields
(
vd
);
else
...
...
bin/varnishstat/varnishstat_curses.c
View file @
47106ec3
...
...
@@ -102,8 +102,12 @@ static VTAILQ_HEAD(, pt) ptlist = VTAILQ_HEAD_INITIALIZER(ptlist);
static
int
n_ptlist
=
0
;
static
int
n_ptarray
=
0
;
static
struct
pt
**
ptarray
=
NULL
;
static
const
struct
VSC_C_mgt
*
VSC_C_mgt
=
NULL
;
static
const
struct
VSC_C_main
*
VSC_C_main
=
NULL
;
static
const
volatile
uint64_t
*
mgt_uptime
;
static
const
volatile
uint64_t
*
main_uptime
;
static
const
volatile
uint64_t
*
main_hit
;
static
const
volatile
uint64_t
*
main_miss
;
static
const
volatile
uint64_t
*
main_cache_hit
;
static
const
volatile
uint64_t
*
main_cache_miss
;
static
int
l_status
,
l_bar_t
,
l_points
,
l_bar_b
,
l_info
;
static
int
colw_name
=
COLW_NAME_MIN
;
...
...
@@ -129,9 +133,9 @@ static void
init_hitrate
(
void
)
{
memset
(
&
hitrate
,
0
,
sizeof
(
struct
hitrate
));
if
(
VSC_C_main
!=
NULL
)
{
hitrate
.
lhit
=
VSC_C_main
->
cache_hit
;
hitrate
.
lmiss
=
VSC_C_main
->
cache_miss
;
if
(
main_cache_hit
!=
NULL
)
{
hitrate
.
lhit
=
*
main_
cache_hit
;
hitrate
.
lmiss
=
*
main_
cache_miss
;
}
hitrate
.
hr_10
.
nmax
=
10
;
hitrate
.
hr_100
.
nmax
=
100
;
...
...
@@ -275,6 +279,19 @@ build_pt_list_cb(void *priv, const struct VSC_point *vpt)
bprintf
(
buf
,
"%s.%s.%s"
,
vpt
->
section
->
type
,
vpt
->
section
->
ident
,
vpt
->
desc
->
name
);
if
(
!
strcmp
(
buf
,
"MGT..uptime"
))
mgt_uptime
=
vpt
->
ptr
;
if
(
!
strcmp
(
buf
,
"MAIN..uptime"
))
main_uptime
=
vpt
->
ptr
;
if
(
!
strcmp
(
buf
,
"MAIN..hit"
))
main_hit
=
vpt
->
ptr
;
if
(
!
strcmp
(
buf
,
"MAIN..miss"
))
main_miss
=
vpt
->
ptr
;
if
(
!
strcmp
(
buf
,
"MAIN..cache_hit"
))
main_cache_hit
=
vpt
->
ptr
;
if
(
!
strcmp
(
buf
,
"MAIN..cache_miss"
))
main_cache_miss
=
vpt
->
ptr
;
VTAILQ_FOREACH
(
pt
,
&
ptlist
,
list
)
{
CHECK_OBJ_NOTNULL
(
pt
,
PT_MAGIC
);
AN
(
pt
->
key
);
...
...
@@ -339,6 +356,13 @@ build_pt_list(struct VSM_data *vd, struct VSM_fantom *fantom)
VTAILQ_INIT
(
&
pt_priv
.
ptlist
);
pt_priv
.
n_ptlist
=
0
;
mgt_uptime
=
NULL
;
main_uptime
=
NULL
;
main_hit
=
NULL
;
main_miss
=
NULL
;
main_cache_hit
=
NULL
;
main_cache_miss
=
NULL
;
(
void
)
VSC_Iter
(
vd
,
fantom
,
build_pt_list_cb
,
&
pt_priv
);
delete_pt_list
();
AN
(
VTAILQ_EMPTY
(
&
ptlist
));
...
...
@@ -384,8 +408,8 @@ sample_points(void)
update_ma
(
&
pt
->
ma_100
,
(
int64_t
)
pt
->
cur
);
update_ma
(
&
pt
->
ma_1000
,
(
int64_t
)
pt
->
cur
);
}
else
if
(
pt
->
semantics
==
'c'
)
{
if
(
VSC_C_main
!=
NULL
&&
VSC_C_main
->
uptime
)
pt
->
avg
=
pt
->
cur
/
VSC_C_main
->
uptime
;
if
(
main_uptime
!=
NULL
&&
*
main_
uptime
)
pt
->
avg
=
pt
->
cur
/
*
main_
uptime
;
else
pt
->
avg
=
0
.;
if
(
pt
->
t_last
)
{
...
...
@@ -403,11 +427,11 @@ sample_hitrate(void)
double
hr
,
mr
,
ratio
;
uint64_t
hit
,
miss
;
if
(
VSC_C_main
==
NULL
)
if
(
main_hit
==
NULL
)
return
;
hit
=
VSC_C_main
->
cache
_hit
;
miss
=
VSC_C_main
->
cache
_miss
;
hit
=
*
main
_hit
;
miss
=
*
main
_miss
;
hr
=
hit
-
hitrate
.
lhit
;
mr
=
miss
-
hitrate
.
lmiss
;
hitrate
.
lhit
=
hit
;
...
...
@@ -542,17 +566,17 @@ draw_status(void)
werase
(
w_status
);
if
(
VSC_C_mgt
!=
NULL
)
up_mgt
=
VSC_C_mgt
->
uptime
;
if
(
VSC_C_main
!=
NULL
)
up_chld
=
VSC_C_main
->
uptime
;
if
(
mgt_uptime
!=
NULL
)
up_mgt
=
*
mgt_
uptime
;
if
(
main_uptime
!=
NULL
)
up_chld
=
*
main_
uptime
;
mvwprintw
(
w_status
,
0
,
0
,
"Uptime mgt: "
);
print_duration
(
w_status
,
up_mgt
);
mvwprintw
(
w_status
,
1
,
0
,
"Uptime child:"
);
print_duration
(
w_status
,
up_chld
);
if
(
VSC_C_mgt
==
NULL
)
if
(
mgt_uptime
==
NULL
)
mvwprintw
(
w_status
,
0
,
COLS
-
strlen
(
discon
),
discon
);
else
if
(
COLS
>
70
)
{
mvwprintw
(
w_status
,
0
,
getmaxx
(
w_status
)
-
37
,
...
...
@@ -1053,8 +1077,6 @@ do_curses(struct VSM_data *vd, double delay)
long
t
;
int
ch
;
double
now
;
struct
VSM_fantom
f_main
=
VSM_FANTOM_NULL
;
struct
VSM_fantom
f_mgt
=
VSM_FANTOM_NULL
;
struct
VSM_fantom
f_iter
=
VSM_FANTOM_NULL
;
interval
=
delay
;
...
...
@@ -1071,8 +1093,6 @@ do_curses(struct VSM_data *vd, double delay)
make_windows
();
doupdate
();
VSC_C_mgt
=
VSC_Mgt
(
vd
,
&
f_mgt
);
VSC_C_main
=
VSC_Main
(
vd
,
&
f_main
);
init_hitrate
();
while
(
keep_running
)
{
if
(
VSM_Abandoned
(
vd
))
{
...
...
@@ -1081,8 +1101,6 @@ do_curses(struct VSM_data *vd, double delay)
VSM_Close
(
vd
);
VSM_Open
(
vd
);
}
VSC_C_mgt
=
VSC_Mgt
(
vd
,
&
f_mgt
);
VSC_C_main
=
VSC_Main
(
vd
,
&
f_main
);
if
(
VSM_valid
!=
VSM_StillValid
(
vd
,
&
f_iter
))
build_pt_list
(
vd
,
&
f_iter
);
...
...
include/vapi/vsc.h
View file @
47106ec3
...
...
@@ -53,29 +53,6 @@ int VSC_Arg(struct VSM_data *vd, int arg, const char *opt);
* 1 Handled.
*/
struct
VSC_C_mgt
*
VSC_Mgt
(
const
struct
VSM_data
*
vd
,
struct
VSM_fantom
*
fantom
);
struct
VSC_C_main
*
VSC_Main
(
const
struct
VSM_data
*
vd
,
struct
VSM_fantom
*
fantom
);
/*
* Looks up and returns the management stats and the child main
* stats structure. If fantom is non-NULL, it can later be used
* with VSM_StillValid. Returns NULL until the management process
* has finished initialization or the child has been started.
*
* The returned structure is valid for at most 60 seconds after
* VSM_StillValid(,fantom) starts returning VSM_invalid. Using the
* pointer after this event gives undefined behavior.
*
* Arguments:
* vd: The VSM_data context
* fantom: Pointer to a fantom. Can be NULL.
*
* Return values:
* NULL: Failure
* non-NULL: Success
*/
void
*
VSC_Get
(
const
struct
VSM_data
*
vd
,
struct
VSM_fantom
*
fantom
,
const
char
*
type
,
const
char
*
ident
);
/*
...
...
lib/libvarnishapi/vsc.c
View file @
47106ec3
...
...
@@ -217,24 +217,6 @@ VSC_Arg(struct VSM_data *vd, int arg, const char *opt)
}
}
/*--------------------------------------------------------------------*/
struct
VSC_C_mgt
*
VSC_Mgt
(
const
struct
VSM_data
*
vd
,
struct
VSM_fantom
*
fantom
)
{
return
(
VSC_Get
(
vd
,
fantom
,
VSC_type_mgt
,
""
));
}
/*--------------------------------------------------------------------*/
struct
VSC_C_main
*
VSC_Main
(
const
struct
VSM_data
*
vd
,
struct
VSM_fantom
*
fantom
)
{
return
(
VSC_Get
(
vd
,
fantom
,
VSC_type_main
,
""
));
}
/*--------------------------------------------------------------------
*/
...
...
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