Alien-libhisto

 view release on metacpan or  search on metacpan

bundled/include/histo/cli.h  view on Meta::CPAN

 *
 * @param argc Argument count.
 * @param argv Argument vector.
 * @param out Output stream for normal emission (e.g. stdout).
 * @param err Error stream for diagnostics and logging (e.g. stderr).
 * @return 0 on success, non-zero exit status code on error.
 */
int histo_cli_main(int argc, char **argv, FILE *out, FILE *err);

/**
 * @brief CLI streaming ingestion and aggregation tool (histo-fill).
 *
 * @param argc Argument count.
 * @param argv Argument vector.
 * @param out Output stream for serialized histogram (binary, JSON, or summary).
 * @param err Error stream for status and progress.
 * @return 0 on success, non-zero exit status code on error.
 */
int histo_cli_fill(int argc, char **argv, FILE *out, FILE *err);

/**

bundled/include/histo/sketch.h  view on Meta::CPAN

/**
 * @file sketch.h
 * @brief Public C API for DDSketch online quantile streaming sketches.
 */

#ifndef LIBHISTO_SKETCH_H
#define LIBHISTO_SKETCH_H

/**
 * @file sketch.h
 * @brief Online Dynamic Quantile Sketch (bounded relative-error, based on DDSketch).
 *
 * Provides dynamic logarithmic-binning quantile sketches capable of tracking

bundled/tools/src/cmd_fill.c  view on Meta::CPAN

#include <stdbool.h>
#include <ctype.h>
#include <math.h>
#include <unistd.h>


static void print_fill_usage(FILE *out) {
    if (!out) out = stdout;
    fprintf(out, "Usage: histo-fill [OPTIONS] [FILE...]\n");
    fprintf(out, "       histo fill [OPTIONS] [FILE...]\n\n");
    fprintf(out, "Reads streaming data, aggregates into a histogram (1D or 2D), and emits the serialized result.\n\n");
    fprintf(out, "1D Geometry Options:\n");
    fprintf(out, "  -n, --bins=<N>           Number of uniform bins (default: 50)\n");
    fprintf(out, "      --min=<X>            Lower boundary (required unless --auto-range)\n");
    fprintf(out, "      --max=<X>            Upper boundary (required unless --auto-range)\n");
    fprintf(out, "      --edges=<E0,E1,...>  Variable bin edges (comma-separated)\n");
    fprintf(out, "      --auto-range         Buffer input to determine min/max automatically\n");
    fprintf(out, "  -a, --auto-bins[=RULE]   Buffer input and estimate optimal bins (fd, scott, sturges, doane, knuth)\n\n");
    fprintf(out, "2D Geometry Options:\n");
    fprintf(out, "      --2d                 Enable 2D bivariate histogramming mode\n");
    fprintf(out, "      --xbins=<N>          Number of bins along X axis (default: 50)\n");

bundled/tools/src/cmd_top.c  view on Meta::CPAN

static void render_help_viewport(tui_frame_t *f, const tui_state_t *st, int width, int max_rows) {
    if (st && st->view_mode == VIEW_2D_HEATMAP) {
        const char *help_lines_2d[] = {
            "── Interactive Help Cheatsheet (2D Heatmap Mode) ───────────────────────────",
            "",
            "DISPLAY & INTENSITY SCALING",
            "  l           Toggle Log-Z intensity color scale (LIN <-> LOG-Z)",
            "  p / P       Cycle color palettes (viridis, plasma, inferno, magma, turbo, cividis, gray, rainbow)",
            "  C           Toggle TrueColor / Monochrome ASCII density",
            "  g           Toggle Color Range Legend reference bar",
            "  [Space]     Freeze / Unfreeze live streaming display",
            "  c           Clear all accumulators and reset live count",
            "",
            "COMMANDS & PROMPT (:)",
            "  :palette <NAME> Set color palette (or shorthand :p <NAME>)",
            "  :clear      Clear accumulators",
            "  :quit / :q  Quit application cleanly",
            "  :help       Open this help modal",
            "",
            "Press [?], [Esc], or [Space] to dismiss this help window."
        };

bundled/tools/src/cmd_top.c  view on Meta::CPAN

        st->modal = MODAL_HELP;
    } else if (strcasecmp(cmd, "quit") == 0 || strcasecmp(cmd, "q") == 0) {
        eng->running = false;
    }
}

static void print_top_usage(FILE *out) {
    if (!out) out = stdout;
    fprintf(out, "Usage: histo-top [OPTIONS] [FILE]\n");
    fprintf(out, "       histo top [OPTIONS] [FILE]\n\n");
    fprintf(out, "Real-time interactive terminal monitor for streaming 1D/2D distributions.\n\n");
    fprintf(out, "1D Geometry Options:\n");
    fprintf(out, "  -n, --bins=<N>           Initial number of bins (default: 50)\n");
    fprintf(out, "      --min=<X>            Initial lower boundary (default: 0.0)\n");
    fprintf(out, "      --max=<X>            Initial upper boundary (default: 100.0)\n");
    fprintf(out, "  -a, --auto-range         Enable dynamic quantile auto-ranging (default: ON)\n");
    fprintf(out, "      --no-auto-range      Disable dynamic auto-ranging\n\n");
    fprintf(out, "2D Geometry Options:\n");
    fprintf(out, "      --2d                 Enable 2D bivariate heatmap mode\n");
    fprintf(out, "      --xbins=<N>          Number of bins along X axis (default: 50)\n");
    fprintf(out, "      --xmin=<X>, --xmax=<X> Initial X axis bounds (default: [0, 100])\n");

bundled/tools/src/cmd_top.c  view on Meta::CPAN

                if (snap_2d && n_entries > 0) {
                    histo2d_axis_t ax, ay;
                    histo2d_axis_x(snap_2d, &ax);
                    histo2d_axis_y(snap_2d, &ay);
                    snprintf(stats_buf, sizeof(stats_buf),
                             "X: [%.2f, %.2f] %ux │ Y: [%.2f, %.2f] %uy │ Entries: %lu │ Weight: %.2f",
                             ax.min, ax.max, histo2d_nbins_x(snap_2d),
                             ay.min, ay.max, histo2d_nbins_y(snap_2d),
                             (unsigned long)n_entries, tot_w);
                } else {
                    snprintf(stats_buf, sizeof(stats_buf), "Waiting for streaming 'x y' samples...");
                }
            } else {
                if (snap && n_entries > 0) {
                    double mean = 0, sdev = 0, med = 0, iqr = 0, p95 = 0, p99 = 0;
                    histo_mean(snap, &mean);
                    histo_std_dev(snap, &sdev);
                    histo_median(snap, &med);
                    histo_iqr(snap, &iqr);
                    histo_quantile(snap, 0.95, &p95);
                    histo_quantile(snap, 0.99, &p99);
                    snprintf(stats_buf, sizeof(stats_buf), "Mean: %.2f ± %.2f │ Med: %.2f │ IQR: %.2f │ P95: %.2f │ P99: %.2f",
                             mean, sdev, med, iqr, p95, p99);
                } else {
                    snprintf(stats_buf, sizeof(stats_buf), "Waiting for streaming samples...");
                }
            }
            tui_render_row(&frame, stats_buf, cols, true);

            // Row 3: Divider
            render_divider(&frame, cols);

            // Row 4: Subheader
            char subhdr[384];
            if (eng.is_2d) {

lib/Alien/libhisto.pm  view on Meta::CPAN

 use Alien::libhisto;

 my $ffi = FFI::Platypus->new( api => 2 );
 $ffi->lib( Alien::libhisto->dynamic_libs );
 $ffi->attach( histo_version => [] => 'string' );
 print histo_version();

=head1 DESCRIPTION

C<Alien::libhisto> provides the C<libhisto> C histogramming, curve-fitting,
and streaming quantile sketch library for use by Perl XS and FFI modules.

It probes for an existing installation of C<libhisto> via C<pkg-config>. If not
found, it builds C<libhisto> from source using CMake and installs it into Perl's
shared distribution directory.

=head1 SEE ALSO

=over 4

=item * L<Math::Histo>



( run in 1.032 second using v1.01-cache-2.11-cpan-9789f410c06 )