-
Notifications
You must be signed in to change notification settings - Fork 864
header_rewrite: count operators and conditions run #13286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,24 @@ | |
| // | ||
| #include "statement.h" | ||
|
|
||
| int hrw_stat_operators = TS_ERROR; | ||
| int hrw_stat_conditions = TS_ERROR; | ||
|
|
||
| void | ||
| init_hrw_work_stats() | ||
| { | ||
| // Plugin init is single-threaded, so the create-once guard is safe. header_rewrite.so can | ||
| // be loaded both globally and as a remap plugin; both must share one process-wide stat. | ||
| if (TS_ERROR == hrw_stat_operators) { | ||
| hrw_stat_operators = TSStatCreate("proxy.process.plugin.header_rewrite.operators", TS_RECORDDATATYPE_INT, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Our API documentation says that |
||
| TS_STAT_NON_PERSISTENT, TS_STAT_SYNC_COUNT); | ||
| } | ||
| if (TS_ERROR == hrw_stat_conditions) { | ||
| hrw_stat_conditions = TSStatCreate("proxy.process.plugin.header_rewrite.conditions", TS_RECORDDATATYPE_INT, | ||
| TS_STAT_NON_PERSISTENT, TS_STAT_SYNC_COUNT); | ||
| } | ||
| } | ||
|
|
||
| void | ||
| Statement::append(Statement *stmt) | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,13 @@ | |
| #include "parser.h" | ||
| #include "lulu.h" | ||
|
|
||
| // Counters for the number of header_rewrite operators executed and conditions evaluated; the | ||
| // bare hook invocation count cannot tell a small ruleset from a large one. Created once via | ||
| // init_hrw_work_stats(); both are TS_ERROR until then, so increments are guarded. | ||
|
Comment on lines
+35
to
+37
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is |
||
| extern int hrw_stat_operators; | ||
| extern int hrw_stat_conditions; | ||
| void init_hrw_work_stats(); | ||
|
|
||
| namespace header_rewrite_ns | ||
| { | ||
| constexpr int NUM_STATE_FLAGS = 16; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good comment.