Replace stats with SMF Type 243 + counters#55
Merged
mgrossmann merged 6 commits intomainfrom Apr 11, 2026
Merged
Conversation
Delete httpstat.c (509 LOC) and rewrite httprepo.c to write SMF Type 243 records per HTTP request via crent370's smf_init()/smf_write() API. Replace ~16 KB of in-memory time-series arrays with four simple counters (total_requests, total_errors, total_bytes_sent, active_connections). - Remove HTTPSTAT struct, 4 stat arrays, dataset load/save - Remove FILE *stats log file handle - Remove 6 parmlib keywords (CLIENT_STATS_*_MAX, CLIENT_STATS_DATASET) - Simplify /F HTTPD,D S to show counter values via WTO - Simplify /F HTTPD,S STATS to ON|OFF [RESET] - Track active_connections in httpd.c (accept) and httpclos.c (close) - Counters always increment; SMF recording controlled by CLIENT_STATS Fixes #54
1dd4174 to
7111149
Compare
Rename ssi[4] to subsys[8] in smf_httpd_request to allow different CGI modules to write SMF records with distinct subsystem IDs (e.g. "HTTPD ", "MVSMF ", "HTTPLUA ", "HTTPREXX"). Record size grows from 120 to 124 bytes. Remove temporary debug wtof() calls added during SMF header analysis.
Add parmlib keyword SMF with levels NONE (default), ERROR, AUTH, ALL: - NONE: no SMF recording, only counters - ERROR: write SMF on resp >= 400 - AUTH: write on 401/403 and errors - ALL: every request (sub=1) + session close records (sub=2) Optional TYPE=nnn parameter overrides the default SMF type 243. New HTTPD struct fields: smf_level, smf_type (reuse bytes at 0x67-0x68). Session record (subtype 2) written in httpclos.c on final disconnect when level=ALL, includes request_count and total_bytes per connection. Console commands updated: - D S shows SMF level and type - S STATS NONE|ERROR|AUTH|ALL [RESET]
Request record (subtype 1): - Change resp_code from short to unsigned int, eliminating 2 bytes of compiler-inserted padding before bytes_sent - Change duration_ms to duration_us (microseconds) Session record (subtype 2): - Fill connect_time with SMF time (1/100s since midnight) at accept - Fill duration_us from session elapsed time - Fill total_bytes from new httpc->total_bytes_sent accumulator (not reset on keep-alive, only on new connection) HTTPC struct (stays 4096 bytes): - Replace request_count (unsigned short) + unused3 with three unsigned fields: connect_time, total_bytes_sent, request_count - CBUFSIZE shrinks from 4008 to 4000 bytes (buf starts at 0x60) - Update httpcgi.h to match
Compute session duration from connect_time to current time instead of httpc->end - httpc->start (which only reflects the last request due to keep-alive resets). Remove debug WTO. Previous commit changed HTTPC struct layout but only recompiled 2 of 112 modules — all modules now rebuilt with correct field offsets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
httpstat.c(509 LOC) — removes 4-tier time-series arrays (~16 KB RAM), dataset load/save, lock-protected stat updateshttprepo.cwith SMF Type 243 recording via crent370'ssmf_init()/smf_write()APISMF=NONE|ERROR|AUTH|ALL [TYPE=nnn](default: NONE)total_requests,total_errors,total_bytes_sent,active_connectionsconnect_time,total_bytes_sent,request_countin HTTPC structD Sshows SMF level/type + counters,S STATS NONE|ERROR|AUTH|ALL [RESET]Changes by file
src/httpstat.csrc/httprepo.cinclude/httpd.hinclude/httpcgi.hsrc/httpd.csrc/httpclos.csrc/httpcons.csrc/httpprm.csrc/httpdsrv.csamplib/httpprm0CLAUDE.mddoc/architecture.mdVerified on MVS
make build+make link— 112 modules RC=0, 10 load modules linked/F HTTPD,D Sshows SMF level and counters/F HTTPD,S STATS ALL/NONE/RESETworksFixes #54