feat(scheduler-sim-diagnostics): add fmt_limit_units() sibling (task 8.1)
Adds fmt_limit_units(buf, len, limit, units_mode) to src/lib/xcelimit.c, a units-mode-aware sibling of fmt_limit() following the fmt_jobid()/fmt_jobid_ex() extended-sibling pattern. Reuses fmt_limit()'s exact consumer-dump loop untouched; only the final value line branches: percent limits always render bare "%f%%" regardless of mode, byte-valued (or "swp"-special-cased) absolute values render via xce_format_units_value() (task 7), everything else keeps the unconditional "%f". fmt_limit() itself is now a one-line XCE_UNITS_RAW wrapper around fmt_limit_units() -- provably byte-identical to its prior output for every input shape, so its 5 existing direct unit tests needed zero changes (the regression proof this refactor relies on). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RLSNJhNoULvVcUhXEFafQC
This commit is contained in:
parent
eb23c158ae
commit
9f54c5753f
4 changed files with 362 additions and 5 deletions
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "group.h"
|
||||
#include "kvmgr.h"
|
||||
#include "utils.h"
|
||||
#include "xce/types.h"
|
||||
|
||||
extern int build_consumer(xce_consumer_t**, var, xce_consumer_type_t, int,
|
||||
|
|
@ -20,6 +21,14 @@ extern int build_vres_name(char**, xce_limit_t*, char*, char*, char*);
|
|||
extern int is_host_based_limit(var, xce_limit_t*);
|
||||
extern int fmt_consumer(char*, int, xce_consumer_t*);
|
||||
extern int fmt_limit(char*, int, xce_limit_t*);
|
||||
/* fmt_limit_units() -- scheduler-sim-diagnostics spec, Requirement 6, task
|
||||
* 8.1. Sibling of fmt_limit() (the fmt_jobid()/fmt_jobid_ex() pattern):
|
||||
* identical consumer-dump loop, but the final configured-value line renders
|
||||
* a byte-valued, non-percentage resource's amount via xce_format_units_value()
|
||||
* according to the supplied units_mode instead of always the bare "%f".
|
||||
* fmt_limit() itself is now a one-line wrapper: fmt_limit_units(buf, len,
|
||||
* limit, XCE_UNITS_RAW) -- byte-identical to its own pre-existing output. */
|
||||
extern int fmt_limit_units(char*, int, xce_limit_t*, xce_units_mode_t);
|
||||
extern void kill_limit(xce_limit_t*);
|
||||
extern int instantiate_limit(xce_vres_t**, var, xce_limit_t*, char*, char*,
|
||||
char*);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue