tiny.smg.scan
Defined in tiny.smg.
API (27)
Actions
Public operations.
clonePreparationpreparePathsWithOptionsscanPathsscanPathsWithOptionsscanPreparedscanProjectCached
Types and contracts
Public types and contracts.
CachedProjectCachedProjectTimingCallMetricsIndexCountOptionsOrphanedManualEdgePreparationResolutionBucketResolutionFailureSkippedEdgeSampleStats
Namespaces
Public namespaces.
chiclet: Structural Chiclet source scanner.clikecorefragmentpythonreconcilescan_filesscan_metricsscriptsource_metadata: Exact source evidence shared by language scanners.
Source
Source: tools/smg/src/scan/pipeline/scan.zig:48
zig
pub const CachedProject = struct { stats: Stats, hits: usize, misses: usize, tombstones: usize, timing: CachedProjectTiming,};Source: tools/smg/src/scan/pipeline/scan.zig:56
zig
pub const CachedProjectTiming = struct { manifest_ns: u64 = 0, fragment_read_ns: u64 = 0, fragment_validation_ns: u64 = 0, fragment_fold_ns: u64 = 0, fragment_scan_ns: u64 = 0, suffix_index_ns: u64 = 0, resolution_ns: u64 = 0, call_metrics_ns: u64 = 0, manifest_write_ns: u64 = 0,};Source: tools/smg/src/scan/pipeline/scan.zig:43
Source: tools/smg/src/scan/pipeline/scan.zig:806
zig
pub fn clonePreparation(allocator: std.mem.Allocator, preparation: Preparation) !Preparation { return .{ .plan = try reconcile.clonePlan(allocator, preparation.plan), .nodes_removed = preparation.nodes_removed, };}Source: tools/smg/src/scan/pipeline/scan.zig:785
zig
pub fn preparePathsWithOptions(allocator: std.mem.Allocator, graph: *graph_mod.Graph, root: []const u8, paths: []const []const u8, clean: bool, options: Options) !Preparation { var stats = Stats{}; var project_options = options; project_options.excludes = try scan_files.projectExcludes( allocator, root, options.excludes, options.limits.scan, ); const plan = try reconcile.prepare( allocator, graph, root, paths, clean, project_options, &stats, ); return .{ .plan = plan, .nodes_removed = stats.nodes_removed };}Source: tools/smg/src/scan/pipeline/scan.zig:762
zig
pub fn scanPaths( allocator: std.mem.Allocator, graph: *graph_mod.Graph, root: []const u8, paths: []const []const u8, clean: bool, limits: smg.Limits,) !Stats { return try scanPathsWithOptions( allocator, graph, root, paths, clean, .{ .limits = limits }, );}Source: tools/smg/src/scan/pipeline/scan.zig:780
zig
pub fn scanPathsWithOptions(allocator: std.mem.Allocator, graph: *graph_mod.Graph, root: []const u8, paths: []const []const u8, clean: bool, options: Options) !Stats { const preparation = try preparePathsWithOptions(allocator, graph, root, paths, clean, options); return try scanPrepared(allocator, graph, root, preparation, options);}Source: tools/smg/src/scan/pipeline/scan.zig:813
zig
pub fn scanPrepared(allocator: std.mem.Allocator, graph: *graph_mod.Graph, root: []const u8, preparation: Preparation, options: Options) !Stats { var stats = Stats.init(options.phases orelse allocator); stats.nodes_removed = preparation.nodes_removed; defer stats.retireDeferred(); defer stats.retireMetricInputs(); var phase_arena = std.heap.ArenaAllocator.init(options.phases orelse allocator); defer phase_arena.deinit(); for (preparation.plan.files) |file| { _ = phase_arena.reset(.retain_capacity); const scratch = phase_arena.allocator(); const path = try std.fs.path.join(scratch, &.{ root, file }); const source = text.readFileZ( scratch, path, options.limits.scan.max_source_file_bytes, ) catch |err| switch (err) { error.StreamTooLong => return error.MaxSourceFileBytesExceeded, else => continue, }; try scanFile( allocator, scratch, graph, root, path, source, &stats, options.limits, ); } _ = phase_arena.reset(.free_all); try reconcile.finish(allocator, graph, preparation.plan, &stats); try graph_mod.buildSuffixIndex(graph); try resolveDeferredEdges( allocator, options.phases orelse allocator, graph, &stats, ); _ = phase_arena.reset(.retain_capacity); try updateCallMetrics( allocator, phase_arena.allocator(), graph, preparation.plan.files, stats.resolution_failures.items, ); stats.retireDeferred(); stats.retireMetricInputs(); return stats;}Source: tools/smg/src/scan/pipeline/scan.zig:872
zig
pub fn scanProjectCached( allocator: std.mem.Allocator, phases: std.mem.Allocator, graph: *graph_mod.Graph, root: []const u8, state: scan_files.ProjectState, executable: scan_files.SourceDigest, limits: smg.Limits,) !CachedProject { var timing: CachedProjectTiming = .{}; var phase_started = sys.time.nanoTimestamp(); var stats = Stats.init(phases); defer stats.retireDeferred(); defer stats.retireMetricInputs(); var manifest = try fragment.loadManifest( allocator, phases, root, executable, limits.scan, ); timing.manifest_ns = elapsedNanoseconds(&phase_started); defer manifest.deinit(); var scratch_arena = std.heap.ArenaAllocator.init(phases); defer scratch_arena.deinit(); var scan_arena = std.heap.ArenaAllocator.init(phases); defer scan_arena.deinit(); var hits: usize = 0; var misses: usize = 0; var stable = true; for (state.sources) |source| { const result = try scanProjectSource( allocator, &scratch_arena, &scan_arena, graph, &stats, &manifest, root, executable, source, &timing, limits, ); switch (result) { .hit => hits += 1, .miss => misses += 1, .changed => { misses += 1; stable = false; }, .unavailable => stable = false, } } try finishCachedProject( allocator, phases, graph, state.sources, &stats, &timing, ); _ = scratch_arena.reset(.free_all); phase_started = sys.time.nanoTimestamp(); const tombstones = if (stable) fragment.writeManifest( allocator, scratch_arena.allocator(), root, executable, state.project, &manifest, state.sources, limits.scan, ) catch 0 else 0; timing.manifest_write_ns = elapsedNanoseconds(&phase_started); return .{ .stats = stats, .hits = hits, .misses = misses, .tombstones = tombstones, .timing = timing, };}Source: tools/smg/src/root.zig:30
zig
pub const scan = @import("scan/root.zig");Source: tools/smg/src/scan/root.zig
zig
const pipeline = @import("pipeline/root.zig");pub const core = @import("core/root.zig");pub const scan_files = @import("files.zig");pub const fragment = @import("fragment.zig");pub const scan_metrics = @import("metrics.zig");pub const chiclet = @import("chiclet.zig");pub const clike = @import("clike.zig");pub const python = @import("python.zig");pub const reconcile = @import("reconcile/root.zig");pub const script = @import("script.zig");pub const source_metadata = @import("source.zig");pub const Stats = pipeline.Stats;pub const Count = pipeline.Count;pub const SkippedEdgeSample = pipeline.SkippedEdgeSample;pub const OrphanedManualEdge = pipeline.OrphanedManualEdge;pub const ResolutionBucket = pipeline.ResolutionBucket;pub const ResolutionFailure = pipeline.ResolutionFailure;pub const Options = pipeline.Options;pub const Preparation = pipeline.Preparation;pub const scanPaths = pipeline.scanPaths;pub const scanPathsWithOptions = pipeline.scanPathsWithOptions;pub const preparePathsWithOptions = pipeline.preparePathsWithOptions;pub const clonePreparation = pipeline.clonePreparation;pub const scanPrepared = pipeline.scanPrepared;pub const scanProjectCached = pipeline.scanProjectCached;pub const CachedProject = pipeline.CachedProject;pub const CachedProjectTiming = pipeline.CachedProjectTiming;pub const CallMetricsIndex = @import("metrics.zig").CallMetricsIndex;Complete call list for scan.scanProjectCached
8 direct calls.
tiny.smg.scan.Stats.init[function] attools/smg/src/scan/core/types.zig:22tiny.smg.scan.Stats.retireDeferred[method] attools/smg/src/scan/core/types.zig:36tiny.smg.scan.Stats.retireMetricInputs[method] attools/smg/src/scan/core/types.zig:57tiny.smg.scan.fragment.loadManifest[function] attools/smg/src/scan/fragment.zig:218tiny.smg.scan.fragment.writeManifest[function] attools/smg/src/scan/fragment.zig:266tools.smg.src.scan.pipeline.scan.elapsedNanoseconds[function] — private; no exact target attools/smg/src/scan/pipeline/scan.zig:1133in nearest public ownertools.smg.src.scan.pipeline.scantools.smg.src.scan.pipeline.scan.finishCachedProject[function] — private; no exact target attools/smg/src/scan/pipeline/scan.zig:1105in nearest public ownertools.smg.src.scan.pipeline.scantools.smg.src.scan.pipeline.scan.scanProjectSource[function] — private; no exact target attools/smg/src/scan/pipeline/scan.zig:959in nearest public ownertools.smg.src.scan.pipeline.scan
Audit
| Definitions | 10 |
|---|---|
| Public names | 10 |
| Members | 16 |
| Version | 26.7.0 |
| Revision | daab053ee433 |