Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnishevent
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
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
varnishevent
Commits
529d30f3
Commit
529d30f3
authored
Jun 19, 2015
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "make the occupancy stats private to MON_, tighten the lock, and"
This reverts commit
c4cbd278
.
parent
c4cbd278
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
18 deletions
+11
-18
data.c
src/data.c
+1
-0
monitor.c
src/monitor.c
+2
-16
test_writer.c
src/test/test_writer.c
+0
-1
varnishevent.c
src/varnishevent.c
+6
-0
varnishevent.h
src/varnishevent.h
+2
-1
No files found.
src/data.c
View file @
529d30f3
...
@@ -192,6 +192,7 @@ DATA_Init(void)
...
@@ -192,6 +192,7 @@ DATA_Init(void)
VSTAILQ_INSERT_TAIL
(
&
freetxhead
,
&
txn
[
i
],
freelist
);
VSTAILQ_INSERT_TAIL
(
&
freetxhead
,
&
txn
[
i
],
freelist
);
}
}
tx_occ
=
rec_occ
=
chunk_occ
=
tx_occ_hi
=
rec_occ_hi
=
chunk_occ_hi
=
0
;
global_nfree_tx
=
config
.
max_data
;
global_nfree_tx
=
config
.
max_data
;
global_nfree_rec
=
nrecords
;
global_nfree_rec
=
nrecords
;
global_nfree_chunk
=
nchunks
;
global_nfree_chunk
=
nchunks
;
...
...
src/monitor.c
View file @
529d30f3
...
@@ -43,9 +43,6 @@ static int run = 0;
...
@@ -43,9 +43,6 @@ static int run = 0;
static
pthread_t
monitor
;
static
pthread_t
monitor
;
static
pthread_mutex_t
stats_lock
=
PTHREAD_MUTEX_INITIALIZER
;
static
pthread_mutex_t
stats_lock
=
PTHREAD_MUTEX_INITIALIZER
;
static
unsigned
tx_occ
=
0
,
rec_occ
=
0
,
chunk_occ
=
0
,
tx_occ_hi
=
0
,
rec_occ_hi
=
0
,
chunk_occ_hi
=
0
;
static
void
static
void
log_output
(
void
)
log_output
(
void
)
{
{
...
@@ -118,35 +115,24 @@ MON_Start(void)
...
@@ -118,35 +115,24 @@ MON_Start(void)
void
void
MON_StatsUpdate
(
stats_update_t
update
,
unsigned
nrec
,
unsigned
nchunk
)
MON_StatsUpdate
(
stats_update_t
update
,
unsigned
nrec
,
unsigned
nchunk
)
{
{
AZ
(
pthread_mutex_lock
(
&
stats_lock
));
switch
(
update
)
{
switch
(
update
)
{
case
STATS_WRITTEN
:
case
STATS_WRITTEN
:
AZ
(
pthread_mutex_lock
(
&
stats_lock
));
AN
(
tx_occ
);
assert
(
rec_occ
>=
nrec
);
assert
(
chunk_occ
>=
nchunk
);
tx_occ
--
;
tx_occ
--
;
rec_occ
-=
nrec
;
rec_occ
-=
nrec
;
chunk_occ
-=
nchunk
;
chunk_occ
-=
nchunk
;
AZ
(
pthread_mutex_unlock
(
&
stats_lock
));
break
;
break
;
case
STATS_DONE
:
case
STATS_DONE
:
AZ
(
pthread_mutex_lock
(
&
stats_lock
));
tx_occ
++
;
tx_occ
++
;
rec_occ
+=
nrec
;
rec_occ
+=
nrec
;
chunk_occ
+=
nchunk
;
chunk_occ
+=
nchunk
;
AZ
(
pthread_mutex_unlock
(
&
stats_lock
));
if
(
tx_occ
>
tx_occ_hi
)
tx_occ_hi
=
tx_occ
;
if
(
rec_occ
>
rec_occ_hi
)
rec_occ_hi
=
rec_occ
;
if
(
chunk_occ
>
chunk_occ_hi
)
chunk_occ_hi
=
chunk_occ
;
break
;
break
;
default:
default:
/* Unreachable */
/* Unreachable */
AN
(
NULL
);
AN
(
NULL
);
}
}
AZ
(
pthread_mutex_unlock
(
&
stats_lock
));
}
}
src/test/test_writer.c
View file @
529d30f3
...
@@ -85,7 +85,6 @@ static char
...
@@ -85,7 +85,6 @@ static char
for
(
int
i
=
0
;
i
<
THRESHOLD
;
i
++
)
{
for
(
int
i
=
0
;
i
<
THRESHOLD
;
i
++
)
{
tx
.
occupied
=
1
;
tx
.
occupied
=
1
;
tx
.
type
=
VSL_t_req
;
tx
.
type
=
VSL_t_req
;
MON_StatsUpdate
(
STATS_DONE
,
1
,
1
);
wrt_write
(
&
tx
);
wrt_write
(
&
tx
);
MAZ
(
to
.
tv_sec
);
MAZ
(
to
.
tv_sec
);
...
...
src/varnishevent.c
View file @
529d30f3
...
@@ -355,6 +355,12 @@ event(struct VSL_data *vsl, struct VSL_transaction * const pt[], void *priv)
...
@@ -355,6 +355,12 @@ event(struct VSL_data *vsl, struct VSL_transaction * const pt[], void *priv)
tx
->
occupied
=
1
;
tx
->
occupied
=
1
;
seen
++
;
seen
++
;
MON_StatsUpdate
(
STATS_DONE
,
nrec
,
total_chunks
);
MON_StatsUpdate
(
STATS_DONE
,
nrec
,
total_chunks
);
if
(
tx_occ
>
tx_occ_hi
)
tx_occ_hi
=
tx_occ
;
if
(
rec_occ
>
rec_occ_hi
)
rec_occ_hi
=
rec_occ
;
if
(
chunk_occ
>
chunk_occ_hi
)
chunk_occ_hi
=
chunk_occ
;
submit
(
tx
);
submit
(
tx
);
}
}
...
...
src/varnishevent.h
View file @
529d30f3
...
@@ -119,7 +119,8 @@ typedef VSTAILQ_HEAD(txhead_s, tx_t) txhead_t;
...
@@ -119,7 +119,8 @@ typedef VSTAILQ_HEAD(txhead_s, tx_t) txhead_t;
#define OCCUPIED(p) ((p)->occupied == 1)
#define OCCUPIED(p) ((p)->occupied == 1)
unsigned
global_nfree_tx
,
global_nfree_rec
,
global_nfree_chunk
;
unsigned
tx_occ
,
rec_occ
,
chunk_occ
,
tx_occ_hi
,
rec_occ_hi
,
chunk_occ_hi
,
global_nfree_tx
,
global_nfree_rec
,
global_nfree_chunk
;
/* Writer (consumer) waits for this condition when the SPSC queue is empty.
/* Writer (consumer) waits for this condition when the SPSC queue is empty.
Reader (producer) signals the condition after enqueue. */
Reader (producer) signals the condition after enqueue. */
...
...
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