zpmod
b19981f
High-performance Zsh module for script optimization and filesystem helpers
|
Public interfaces for source-study and source overrides. More...
Go to the source code of this file.
Data Structures | |
struct | source_event |
Recorded event for a sourced script. More... | |
struct | zp_sevent_node |
Typedefs | |
typedef struct zp_sevent_node * | SEventNode |
Functions | |
void | zp_free_sevent_node (HashNode hn) |
Hash lifecycle. More... | |
char * | zp_build_source_report (int no_paths, int *rep_size) |
mod_export enum source_return | custom_source (char *s) |
Overridden dot/source and helpers exported from core. More... | |
Eprog | custom_try_source_file (char *file) |
Try to locate or build a ZWC dump for the script and return Eprog. More... | |
int | zp_source_study_core (const char *nam, int report_count, int threshold_ms, int clear_history) |
Public interfaces for source-study and source overrides.
This module instruments sourcing operations to record durations and produce reports, and provides an override for .
/source
builtins to integrate the behavior.
Definition in file zpmod_source.h.
typedef struct zp_sevent_node* SEventNode |
Definition at line 15 of file zpmod_source.h.
mod_export enum source_return custom_source | ( | char * | s | ) |
Overridden dot/source and helpers exported from core.
Overridden dot/source and helpers exported from core.
Integrates with zsh state (opts, cmdstack, funcstack) and restores on exit. Records duration and paths for later consumption by the report generator.
Definition at line 506 of file source.c.
References addhashnode(), cmdsp, cmdstack, custom_try_source_file(), source_event::dir_path, dosetopt(), dupstring(), source_event::duration, errflag, zp_sevent_node::event, execode(), exit_pending, fdtable, source_event::file_name, freeeprog(), source_event::full_path, funcstack, source_event::id, lastval, lineno, source_event::load_error, loop(), loops, movefd(), opts, popheap(), printprompt4(), pushheap(), pwd, retflag, scriptfilename, scriptname, SHIN, shinbufrestore(), shinbufsave(), SHINSTDIN__, sourcelevel, SOURCETRACE__, subsh, thisjob, trap_return, trap_state, source_event::ts, unmeta(), xtrerr, zalloc(), zfree(), zp_conv_opt(), zp_sevent_count, zp_source_events, zshcalloc(), and ztrdup().
Referenced by bin_custom_dot().
Eprog custom_try_source_file | ( | char * | file | ) |
Try to locate or build a ZWC dump for the script and return Eprog.
When possible, compiles to .zwc and loads that for performance. Returns NULL if no dump is available and the caller should use a file fd.
Definition at line 322 of file source.c.
References bin_zcompile(), custom_check_dump_file(), dyncat(), FD_EXT, getsparam(), queue_signals(), strsfx(), unqueue_signals(), zfree(), ztrdup(), and zwarnnam().
Referenced by custom_source().
char* zp_build_source_report | ( | int | no_paths, |
int * | rep_size | ||
) |
void zp_free_sevent_node | ( | HashNode | hn | ) |
Hash lifecycle.
Definition at line 727 of file source.c.
References source_event::dir_path, zp_sevent_node::event, source_event::file_name, source_event::full_path, zfree(), and zsfree().
Referenced by zp_source_setup_overrides().
int zp_source_study_core | ( | const char * | nam, |
int | report_count, | ||
int | threshold_ms, | ||
int | clear_history | ||
) |
Definition at line 8 of file source_study_stub.c.
Referenced by cmd_source_study().