Skip to content

feat(Core/Playerbots): Add pmon file snapshots#2274

Open
scarecr0w12 wants to merge 1 commit intomod-playerbots:test-stagingfrom
scarecr0w12:feature/pmon-file-dump-test-staging
Open

feat(Core/Playerbots): Add pmon file snapshots#2274
scarecr0w12 wants to merge 1 commit intomod-playerbots:test-stagingfrom
scarecr0w12:feature/pmon-file-dump-test-staging

Conversation

@scarecr0w12
Copy link
Copy Markdown

Pull Request Description

Adds a dedicated file output mode for the playerbots pmon command so performance snapshots can be reviewed later instead of only being visible in console/server logs.

The change adds:

  • .playerbots pmon file
  • .playerbots pmon file tick
  • .playerbots pmon file stack

These commands append timestamped snapshots to pmon.log using the module's existing allowed log file mechanism. The existing pmon, pmon tick, pmon stack, pmon reset, and pmon toggle behavior is preserved.

Feature Evaluation

  • Describe the minimum logic required to achieve the intended behavior.
    • Reuse the existing PerfMonitor::PrintStats formatting path and add a file sink that appends the same report lines to pmon.log.
    • Add one explicit GM command path for pmon file [tick|stack].
    • Reuse the existing AiPlayerbot.AllowedLogFiles safeguard instead of introducing a new file permission/config system.
  • Describe the processing cost when this logic executes across many bots.
    • No additional per-bot or per-tick logic is added.
    • The only extra work happens when a GM explicitly runs the pmon file command, at which point the monitor formats the already-collected stats and appends them to disk.
    • Default runtime cost is effectively unchanged.

How to Test the Changes

  1. In playerbots.conf, set:
    • AiPlayerbot.PerfMonEnabled = 1
    • AiPlayerbot.AllowedLogFiles = "pmon.log"
  2. Start worldserver with mod-playerbots enabled.
  3. Generate some bot activity.
  4. Run each command from console or as a GM:
    • .playerbots pmon file
    • .playerbots pmon file tick
    • .playerbots pmon file stack
  5. Verify that pmon.log is created under LogsDir and that each invocation appends a new timestamped snapshot instead of overwriting the file.
  6. Verify existing commands still work as before:
    • .playerbots pmon
    • .playerbots pmon tick
    • .playerbots pmon stack
  7. Verify invalid file subcommands return the usage hint.

Impact Assessment

  • Does this change increase per-bot/per-tick processing or risk scaling poorly with thousands of bots?

      • No, not at all
      • Minimal impact (explain below)
      • Moderate impact (explain below)

    Explanation: the new logic is only executed on explicit GM/console command invocation. It does not add recurring bot AI work.

  • Does this change modify default bot behavior?

      • No
      • Yes (explain why)
  • Does this change add new decision branches or increase maintenance complexity?

      • No
      • Yes (explain below)

AI Assistance

Was AI assistance used while working on this change?

    • No
    • Yes (explain below)

Purpose of usage: code exploration, implementation drafting, and PR body drafting.
All generated or suggested changes were reviewed, adjusted, and understood before preparing the PR.

Final Checklist

    • Stability is not compromised.
    • Performance impact is understood, tested, and acceptable.
    • Added logic complexity is justified and explained.
    • Any new bot dialogue lines are translated.
    • Documentation updated if needed (Conf comments, WiKi commands).

Notes for Reviewers

  • This change intentionally reuses the existing module log allowlist. pmon.log must be added to AiPlayerbot.AllowedLogFiles for file output to work.
  • The new file mode appends snapshots so multiple captures can be compared over time.

@scarecr0w12
Copy link
Copy Markdown
Author

quick test out put to show working
pmon.log

@scarecr0w12
Copy link
Copy Markdown
Author

After some discussion, I was informed that this is already logged to the playerbots.log file when running standard commands. However, in my own opinion, separation of the PMON output to a separate, less cluttered file may be more appropriate and easier to navigate when troubleshooting issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant