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
6d68ffef
Commit
6d68ffef
authored
Apr 13, 2015
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added FMT_Estimate_RecsPerTx() (not tested yet)
parent
95f6f8d8
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
63 additions
and
22 deletions
+63
-22
data.c
src/data.c
+1
-10
format.c
src/format.c
+55
-0
Makefile.am
src/test/Makefile.am
+2
-0
test_data.c
src/test/test_data.c
+2
-2
varnishevent.c
src/varnishevent.c
+1
-7
varnishevent.h
src/varnishevent.h
+2
-1
writer.c
src/writer.c
+0
-2
No files found.
src/data.c
View file @
6d68ffef
...
...
@@ -53,8 +53,6 @@
} \
} while (0)
#define FAKE_DEFAULT_LINES_PER_TX 10
static
const
char
*
statename
[
3
]
=
{
"EMPTY"
,
"DONE"
};
static
pthread_mutex_t
freetx_lock
=
PTHREAD_MUTEX_INITIALIZER
;
...
...
@@ -65,8 +63,6 @@ static txhead_t freetxhead;
static
linehead_t
freelinehead
;
static
chunkhead_t
freechunkhead
;
static
int
lines_per_tx
=
FAKE_DEFAULT_LINES_PER_TX
;
static
void
data_Cleanup
(
void
)
{
...
...
@@ -109,13 +105,8 @@ DATA_Clear_Tx(tx_t *tx)
int
DATA_Init
(
void
)
{
int
bufidx
=
0
,
chunks_per_rec
;
#if 0
lines_per_tx = FMT_Get_LinesPerTx();
#endif
int
bufidx
=
0
,
chunks_per_rec
,
lines_per_tx
=
FMT_Estimate_RecsPerTx
();
/* XXX: set up tables of txen, lines & chunks, set/estimate sizes */
nrecords
=
config
.
max_data
*
lines_per_tx
;
AN
(
config
.
chunk_size
);
chunks_per_rec
...
...
src/format.c
View file @
6d68ffef
...
...
@@ -1096,6 +1096,61 @@ FMT_Get_i_Arg(void)
return
VSB_data
(
i_arg
);
}
int
FMT_Estimate_RecsPerTx
(
void
)
{
int
recs_per_tx
=
0
,
recs_per_ctx
=
0
,
recs_per_btx
=
0
;
for
(
int
i
=
0
;
i
<
MAX_VSL_TAG
;
i
++
)
{
if
(
rtags
[
i
])
{
recs_per_tx
=
1
;
break
;
}
}
for
(
int
i
=
0
;
i
<
MAX_VSL_TAG
;
i
++
)
{
if
(
ctags
[
i
])
{
switch
(
i
)
{
case
SLT_ReqHeader
:
case
SLT_RespHeader
:
recs_per_ctx
+=
config
.
max_headers
;
break
;
case
SLT_VCL_call
:
case
SLT_VCL_return
:
recs_per_ctx
+=
config
.
max_vcl_call
;
break
;
case
SLT_Timestamp
:
recs_per_ctx
+=
config
.
max_timestamp
;
break
;
default:
recs_per_ctx
++
;
}
}
}
if
(
recs_per_ctx
>
recs_per_tx
)
recs_per_tx
=
recs_per_ctx
;
for
(
int
i
=
0
;
i
<
MAX_VSL_TAG
;
i
++
)
{
if
(
btags
[
i
])
{
switch
(
i
)
{
case
SLT_BereqHeader
:
case
SLT_BerespHeader
:
recs_per_btx
+=
config
.
max_headers
;
break
;
case
SLT_Timestamp
:
recs_per_ctx
+=
config
.
max_timestamp
;
break
;
default:
recs_per_ctx
++
;
}
}
}
if
(
recs_per_btx
>
recs_per_tx
)
recs_per_tx
=
recs_per_btx
;
return
recs_per_tx
;
}
void
FMT_Format
(
tx_t
*
tx
,
struct
vsb
*
os
)
{
...
...
src/test/Makefile.am
View file @
6d68ffef
...
...
@@ -13,6 +13,8 @@ test_data_LDADD = \
../config.
$(OBJEXT)
\
../log.
$(OBJEXT)
\
../data.
$(OBJEXT)
\
../format.
$(OBJEXT)
\
../strfTIM.
$(OBJEXT)
\
@VARNISH_LIBS@ @VARNISH_LIBVARNISH_LIB@
-lm
-lvarnish
test_format_SOURCES
=
\
...
...
src/test/test_data.c
View file @
6d68ffef
...
...
@@ -46,14 +46,14 @@ static char
*
test_data_init
(
void
)
{
int
err
;
char
fmterr
[
BUFSIZ
];
printf
(
"... testing data table initialization
\n
"
);
MAZ
(
LOG_Open
(
"test_data"
));
CONF_Init
();
#if 0
MAZ
(
FMT_Init
(
fmterr
));
#endif
VMASSERT
((
err
=
DATA_Init
())
==
0
,
"DATA_Init: %s"
,
strerror
(
err
));
MAN
(
txn
);
...
...
src/varnishevent.c
View file @
6d68ffef
...
...
@@ -561,12 +561,10 @@ main(int argc, char *argv[])
VAS_Fail
=
assert_fail
;
#if 0
if
(
FMT_Init
(
scratch
)
!=
0
)
{
LOG_Log
(
LOG_ALERT
,
"Error in output formats: %s"
,
scratch
);
exit
(
EXIT_FAILURE
);
}
#endif
if
(
!
EMPTY
(
config
.
varnish_bindump
))
LOG_Log
(
LOG_INFO
,
"Reading from file: %s"
,
config
.
varnish_bindump
);
...
...
@@ -578,9 +576,7 @@ main(int argc, char *argv[])
LOG_Log
(
LOG_INFO
,
"Reading varnish instance %s"
,
scratch
);
}
#if 0
strcpy
(
scratch
,
FMT_Get_i_Arg
());
#endif
if
(
EMPTY
(
scratch
))
{
LOG_Log0
(
LOG_ALERT
,
"Not configured to read any log data, exiting"
);
exit
(
EXIT_FAILURE
);
...
...
@@ -666,9 +662,7 @@ main(int argc, char *argv[])
WRT_Halt
();
SPSCQ_Shutdown
();
MON_Shutdown
();
#if 0
FMT_Shutdown();
#endif
FMT_Fini
();
AZ
(
pthread_cond_destroy
(
&
data_ready_cond
));
AZ
(
pthread_mutex_destroy
(
&
data_ready_lock
));
AZ
(
pthread_cond_destroy
(
&
spscq_ready_cond
));
...
...
src/varnishevent.h
View file @
6d68ffef
...
...
@@ -191,9 +191,9 @@ struct config {
/* varnishd param http_max_hdr */
unsigned
max_headers
;
unsigned
max_vcl_log
;
unsigned
max_vcl_call
;
unsigned
max_timestamp
;
unsigned
max_fd
;
unsigned
max_data
;
...
...
@@ -284,6 +284,7 @@ void MON_Output(void);
/* format.c */
int
FMT_Init
(
char
*
err
);
char
*
FMT_Get_i_Arg
(
void
);
int
FMT_Estimate_RecsPerTx
(
void
);
void
FMT_Format
(
tx_t
*
tx
,
struct
vsb
*
os
);
void
FMT_Fini
(
void
);
...
...
src/writer.c
View file @
6d68ffef
...
...
@@ -177,9 +177,7 @@ wrt_write(tx_t *tx)
AZ
(
pthread_mutex_unlock
(
&
reopen_lock
));
VSB_clear
(
os
);
#if 0
FMT_Format
(
tx
,
os
);
#endif
VSB_finish
(
os
);
if
(
timeout
!=
NULL
)
...
...
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