Repository navigation
feat: multi-state profiler, portable CPU backend, cross-platform CI - #10
Merged
Merged
Conversation
- ProfilerSession per lua_State (map); parallel sessions across states - Separate cpuRunning/memRunning (no shared gRunning mutex) - POSIX ITIMER_PROF/SIGPROF walks all CPU sessions; LUA_MASKCOUNT fallback (default on Windows, optional via PLUA_CPU_BACKEND=count) - .pro v1 header (PLUA magic + version); write error checks; clear string tables on stop; fix llog year (tm_year+1900) - Configurable rates via set_config/get_config and env vars - Windows/POSIX IO isolation; luaopen_plua alias; require Lua >= 5.2
Accept PLUA magic/version header while remaining compatible with legacy profiles; use os.ReadFile/os.WriteFile.
- C++ harness: two-state CPU/mem, cross-mode, stop-one-leaves-other, independent CPU+mem on one state - Lua unit tests: config API, PLUA magic, .dll/.dylib cpath candidates
Keep existing Ubuntu job with examples/visualization; macOS runs ctest; Windows builds libplua.dll (tests optional/deferred when Lua toolchain is incomplete).
Document that multi-state is not multi-OS-thread safe; hookso is Linux only; Lua 5.1/JIT are unsupported; sample-rate API and env vars.
Chocolatey lua is 5.1.5 and lua.org FTP times out on GHA. Fetch lua/lua v5.4.7, compile lua54.dll/lib with cl, point CMake at them.
esrrhs
added a commit
that referenced
this pull request
Nov 3, 2026
Restore full Chinese README (was truncated after PR #10 merge) and polish the English primary so both document platforms, multi-state limits, set_config/env rates, embedding vs Linux-only hookso, .pro v1, and tools/plua.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the pLua multi-state / cross-platform roadmap on top of
master@8d90e03.P0
lua_State:ProfilerSessionper state; parallel CPU/mem sessions across states. Documented: multi-state ≠ multi-OS-thread safe.ITIMER_PROF/SIGPROF(process-wide handler walks registered CPU sessions);LUA_MASKCOUNTfallback (default on Windows, optional viaPLUA_CPU_BACKEND=count).P1
libplua.dll; POSIX isolated; CRT-style file IO; tests include?.dllcpath; hookso marked unsupported..sosuffix for Lua cpath; embed OK / hookso not supported in README.cpuRunning/memRunning(no shared exclusivegRunning).P2
.prov1:PLUAmagic + version header;tools/pluaaccepts v1 and legacy; replaced deprecatedioutil.set_config/get_config+ envPLUA_CPU_INTERVAL_MS,PLUA_CPU_HOOK_COUNT,PLUA_MEM_RATE,PLUA_CPU_BACKEND; optional 3rd args onstart/start_mem.llogyear (tm_year+1900),luaopen_pluaalias.Tests
ctest+lua test_unit.luagreen.API compatibility
start/stop/start_mem/stop_memunchanged for single-state use.How to verify
Out of scope / deferred
windows-latestis best-effort).Notes
feature/multistate-crossplatform.