summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-06-12 17:15:54 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-06-12 17:15:54 -0700
commitf806bf55ee2ada32b2fe9d4a13ccc84552d379d1 (patch)
tree2017a2cf0c9ec1a97e8faaab508344f16cba3600
parent8fdd84d2c743b19ad1ca73c2065f87a09e797377 (diff)
til_args: introduce --print-module-contexts
Some rudimentary instrumentation for monitoring the active module contexts alongside the pipes You probably want to redirect stderr to a file when using --print-pipes and/or --print-module-contexts... e.g. ``` rototiller --defaults --go --print-pipes --print-module-contexts 2>/dev/null ``` or, if you still want to monitor FPS or log_channels=on in rtv, 2>/file/to/tail then tail -F /file/to/tail in another terminal.
-rw-r--r--src/main.c10
-rw-r--r--src/til_args.c17
-rw-r--r--src/til_args.h1
3 files changed, 20 insertions, 8 deletions
diff --git a/src/main.c b/src/main.c
index de26001..8306b64 100644
--- a/src/main.c
+++ b/src/main.c
@@ -338,9 +338,15 @@ static void * rototiller_thread(void *_rt)
til_module_render(rt->module_context, rt->stream, ticks, &fragment);
til_fb_fragment_submit(fragment);
- if (rt->args.print_pipes) { /* render threads are idle at this point */
+ if (rt->args.print_module_contexts || rt->args.print_pipes) {
+ /* render threads are idle at this point */
printf("\x1b[2J\x1b[;H"); /* ANSI codes for clear screen and move cursor to top left */
- til_stream_fprint_pipes(rt->stream, stdout);
+
+ if (rt->args.print_module_contexts)
+ til_stream_fprint_module_contexts(rt->stream, stdout);
+
+ if (rt->args.print_pipes)
+ til_stream_fprint_pipes(rt->stream, stdout);
}
}
diff --git a/src/til_args.c b/src/til_args.c
index 11f2487..7e4c7e6 100644
--- a/src/til_args.c
+++ b/src/til_args.c
@@ -13,6 +13,7 @@
* ./rototiller --go // don't show args and wait for user input before proceeding
* ./rototiller --seed=0xdeadbeef // explicitly set global random seed instead of generating one
* ./rototiller --print-pipes // print values for the pipes every frame
+ * ./rototiller --print-module-contexts // print information about registered module contexts every frame
*
* unrecognized arguments trigger an -EINVAL error, unless res_{argc,argv} are non-NULL
* where a new argv will be allocated and populated with the otherwise invalid arguments
@@ -55,6 +56,8 @@ static int args_parse(int argc, const char *argv[], til_args_t *res_args, int *r
res_args->help = 1;
} else if (!strcasecmp("--go", argv[i])) {
res_args->gogogo = 1;
+ } else if (!strcasecmp("--print-module-contexts", argv[i])) {
+ res_args->print_module_contexts = 1;
} else if (!strcasecmp("--print-pipes", argv[i])) {
res_args->print_pipes = 1;
} else {
@@ -87,11 +90,13 @@ int til_args_parse(int argc, const char *argv[], til_args_t *res_args)
int til_args_help(FILE *out)
{
return fprintf(out,
- " --defaults use defaults for unspecified settings\n"
- " --go start rendering immediately upon fulfilling all required settings\n"
- " --help this help\n"
- " --module= module settings\n"
- " --seed= seed to use for all PRNG in hexadecimal (e.g. 0xdeadbeef)\n"
- " --video= video settings\n"
+ " --defaults use defaults for unspecified settings\n"
+ " --go start rendering immediately upon fulfilling all required settings\n"
+ " --help this help\n"
+ " --module= module settings\n"
+ " --print-module-contexts print active contexts on-stream to stdout\n"
+ " --print-pipes print active pipes on-stream to stdout\n"
+ " --seed= seed to use for all PRNG in hexadecimal (e.g. 0xdeadbeef)\n"
+ " --video= video settings\n"
);
}
diff --git a/src/til_args.h b/src/til_args.h
index 85d4d7b..7c21668 100644
--- a/src/til_args.h
+++ b/src/til_args.h
@@ -11,6 +11,7 @@ typedef struct til_args_t {
unsigned use_defaults:1;
unsigned help:1;
unsigned gogogo:1;
+ unsigned print_module_contexts:1;
unsigned print_pipes:1;
} til_args_t;
© All Rights Reserved