Skip to content

i_1262 Improve sandbox scripts for better reporting CPU time accuracy#1263

Open
johnbrvc wants to merge 1 commit into
pc2ccs:developfrom
johnbrvc:i1262_check_sandbox_cpu_times
Open

i_1262 Improve sandbox scripts for better reporting CPU time accuracy#1263
johnbrvc wants to merge 1 commit into
pc2ccs:developfrom
johnbrvc:i1262_check_sandbox_cpu_times

Conversation

@johnbrvc
Copy link
Copy Markdown
Collaborator

Description of what the PR does

Both the pc2sandbox.sh and pc2sandbox_interactive.sh scripts have been modified to only put the bare minimum amount of work in the cgroup. Previously, some debug logging and other bash related stuff was charged to the cgroup.
CI: Use CPU # (0-(N-1)) instead of ordinal (1-N) to determine the CPU to pin to. Change taskset to use the -c CPU# option instead of the default "mask" option for clarity.
CI: better handling of error conditions in the pc2sandbox_interactive.sh script to create the resource summary report even on failures and PC2 wall time limit exceeded. Previously, resource were not created in these cases. (This makes the Web Judge Interface better).
CI: Add TDEBUG flag to control timing debugging. It is ON by default and logs stuff to the sandbox.log file. It's mostly keeping track of the cgroup cpu.stat file.

Issue which the PR addresses

Fixes #1262

Environment in which the PR was developed (OS,IDE, Java version, etc.)

Linux 24.04.3

Precise steps for testing the PR (i.e., how to demonstrate that it works correctly)

  1. This is only for Linux based systems since sandboxes are currently supported on Linux only.
  2. Compile the samps/src/hello.cpp program.
  3. Execute it from a Linux bash prompt using the Linux "time" program: time ./a.out
  4. Note that it takes on the order of a few milliseconds to run.
  5. Start up a clean PC2 server using the clics_sumithello sample contest.
  6. Start up an administrator client.
  7. Edit the "hello" problem and change it to use a Sandbox.
  8. Start the contest.
  9. Start up an autojudge.
  10. Start up a pc2team client and log in using team1 with password team1.
  11. Submit the samps/src/hello.cpp program for the "hello" problem.
  12. Wait for the submission to be judged.
  13. From a bash command prompt, change to the "execute" folder where the judge executed the submission.
  14. View/edit the sandbox.log file.
  15. Search for the string "CPU ms" - this is the header of 2 line table showing the resources used by the submission.
  16. Note the CPU time below the CPU ms heading is about the same as that observed in step 4.

Both the pc2sandbox and pc2sandbox_interactive scripts have been modified to only put the bare minimum amount of work in the cgroup.  Previously, some debug logging and other bash related stuff was charged to the cgroup.
CI: Use CPU # (0-(N-1)) instead of ordinal (1-N) to determine the CPU to pin to.  Change taskset to use the -c CPU# option instead of the default "mask" option for clarity.
CI: better handling of error conditions in the pc2sandbox_interactive script to create the resource summary report even on failures and PC2 wall time limit exceeded.  Previously, resource were not created in these cases.  (This makes the Web Judge Interface better).
CI: Add TDEBUG falg to control timing debugging.  It is ON by default and logs stuff to the sandbox.log file.  It's mostly keeping track of the cgroup cpu.stat file.
@johnbrvc johnbrvc added this to the 9.11.0 milestone Apr 20, 2026
@johnbrvc johnbrvc self-assigned this Apr 20, 2026
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.

Check CPU time for submissions judged in a sandbox

1 participant