Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
3c8e5203
Commit
3c8e5203
authored
Mar 31, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
ssh://git.varnish-cache.org/git/varnish-cache
parents
8aa94940
e89cffc0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
6 deletions
+22
-6
varnishtop.c
bin/varnishtop/varnishtop.c
+18
-6
varnishtop.rst
doc/sphinx/reference/varnishtop.rst
+4
-0
No files found.
bin/varnishtop/varnishtop.c
View file @
3c8e5203
...
@@ -147,12 +147,13 @@ accumulate(uint32_t * const p)
...
@@ -147,12 +147,13 @@ accumulate(uint32_t * const p)
}
}
static
void
static
void
update
(
const
struct
VSM_data
*
vd
)
update
(
const
struct
VSM_data
*
vd
,
int
period
)
{
{
struct
top
*
tp
,
*
tp2
;
struct
top
*
tp
,
*
tp2
;
int
l
,
len
;
int
l
,
len
;
double
t
=
0
;
double
t
=
0
;
static
time_t
last
=
0
;
static
time_t
last
=
0
;
static
unsigned
n
;
time_t
now
;
time_t
now
;
now
=
time
(
NULL
);
now
=
time
(
NULL
);
...
@@ -161,6 +162,8 @@ update(const struct VSM_data *vd)
...
@@ -161,6 +162,8 @@ update(const struct VSM_data *vd)
last
=
now
;
last
=
now
;
l
=
1
;
l
=
1
;
if
(
n
<
period
)
n
++
;
AC
(
erase
());
AC
(
erase
());
AC
(
mvprintw
(
0
,
0
,
"%*s"
,
COLS
-
1
,
VSM_Name
(
vd
)));
AC
(
mvprintw
(
0
,
0
,
"%*s"
,
COLS
-
1
,
VSM_Name
(
vd
)));
AC
(
mvprintw
(
0
,
0
,
"list length %u"
,
ntop
));
AC
(
mvprintw
(
0
,
0
,
"list length %u"
,
ntop
));
...
@@ -175,7 +178,7 @@ update(const struct VSM_data *vd)
...
@@ -175,7 +178,7 @@ update(const struct VSM_data *vd)
len
,
len
,
tp
->
rec_data
));
len
,
len
,
tp
->
rec_data
));
t
=
tp
->
count
;
t
=
tp
->
count
;
}
}
tp
->
count
*=
.
999
;
tp
->
count
+=
(
1
.
0
/
3
.
0
-
tp
->
count
)
/
(
double
)
n
;
if
(
tp
->
count
*
10
<
t
||
l
>
LINES
*
10
)
{
if
(
tp
->
count
*
10
<
t
||
l
>
LINES
*
10
)
{
VTAILQ_REMOVE
(
&
top_head
,
tp
,
list
);
VTAILQ_REMOVE
(
&
top_head
,
tp
,
list
);
free
(
tp
->
rec_data
);
free
(
tp
->
rec_data
);
...
@@ -211,7 +214,7 @@ accumulate_thread(void *arg)
...
@@ -211,7 +214,7 @@ accumulate_thread(void *arg)
}
}
static
void
static
void
do_curses
(
struct
VSM_data
*
vd
)
do_curses
(
struct
VSM_data
*
vd
,
int
period
)
{
{
pthread_t
thr
;
pthread_t
thr
;
int
i
;
int
i
;
...
@@ -237,7 +240,7 @@ do_curses(struct VSM_data *vd)
...
@@ -237,7 +240,7 @@ do_curses(struct VSM_data *vd)
AC
(
erase
());
AC
(
erase
());
for
(;;)
{
for
(;;)
{
AZ
(
pthread_mutex_lock
(
&
mtx
));
AZ
(
pthread_mutex_lock
(
&
mtx
));
update
(
vd
);
update
(
vd
,
period
);
AZ
(
pthread_mutex_unlock
(
&
mtx
));
AZ
(
pthread_mutex_unlock
(
&
mtx
));
timeout
(
1000
);
timeout
(
1000
);
...
@@ -310,11 +313,12 @@ main(int argc, char **argv)
...
@@ -310,11 +313,12 @@ main(int argc, char **argv)
{
{
struct
VSM_data
*
vd
;
struct
VSM_data
*
vd
;
int
o
,
once
=
0
;
int
o
,
once
=
0
;
float
period
=
60
;
/* seconds */
vd
=
VSM_New
();
vd
=
VSM_New
();
VSL_Setup
(
vd
);
VSL_Setup
(
vd
);
while
((
o
=
getopt
(
argc
,
argv
,
VSL_ARGS
"1fV"
))
!=
-
1
)
{
while
((
o
=
getopt
(
argc
,
argv
,
VSL_ARGS
"1fV
p:
"
))
!=
-
1
)
{
switch
(
o
)
{
switch
(
o
)
{
case
'1'
:
case
'1'
:
AN
(
VSL_Arg
(
vd
,
'd'
,
NULL
));
AN
(
VSL_Arg
(
vd
,
'd'
,
NULL
));
...
@@ -323,6 +327,14 @@ main(int argc, char **argv)
...
@@ -323,6 +327,14 @@ main(int argc, char **argv)
case
'f'
:
case
'f'
:
f_flag
=
1
;
f_flag
=
1
;
break
;
break
;
case
'p'
:
errno
=
0
;
period
=
strtol
(
optarg
,
NULL
,
0
);
if
(
errno
!=
0
)
{
fprintf
(
stderr
,
"Syntax error, %s is not a number"
,
optarg
);
exit
(
1
);
}
break
;
case
'V'
:
case
'V'
:
varnish_version
(
"varnishtop"
);
varnish_version
(
"varnishtop"
);
exit
(
0
);
exit
(
0
);
...
@@ -340,7 +352,7 @@ main(int argc, char **argv)
...
@@ -340,7 +352,7 @@ main(int argc, char **argv)
VSL_NonBlocking
(
vd
,
1
);
VSL_NonBlocking
(
vd
,
1
);
do_once
(
vd
);
do_once
(
vd
);
}
else
{
}
else
{
do_curses
(
vd
);
do_curses
(
vd
,
period
);
}
}
exit
(
0
);
exit
(
0
);
}
}
doc/sphinx/reference/varnishtop.rst
View file @
3c8e5203
...
@@ -60,6 +60,10 @@ The following options are available:
...
@@ -60,6 +60,10 @@ The following options are available:
-i tag Include log entries with the specified tag. If neither ``-I``
-i tag Include log entries with the specified tag. If neither ``-I``
nor ``-i`` is specified, all log entries are included.
nor ``-i`` is specified, all log entries are included.
-p period Specifies the number of seconds to measure over, the default
is 60 seconds. The first number in the list is the average
number of requests seen over this time period.
-n Specifies the name of the varnishd instance to get logs from.
-n Specifies the name of the varnishd instance to get logs from.
If ``-n`` is not specified, the host name is used.
If ``-n`` is not specified, the host name is used.
...
...
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