Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-67052

Create per action CPU metrics for linux

    • Type: Icon: New Feature New Feature
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • Dev Platform 2022-06-27, Dev Platform 2022-07-11

      For Command line actions, we can take over the SPAWN construction variable, which will call our own spawn function and then we can tailor the command and process output before returning back to scons.

      For function actions we can duck-type the FunctionAction calls to execute from our own function.

      CPU

      Windows makes it a bit difficult to get this info, however chromium already has a good solution:
      https://chromium.googlesource.com/native_client/src/native_client/+/refs/heads/main/tools/test_lib.py

      That solution is cross platform as well.

      For function actions there is https://docs.python.org/3/library/time.html#time.thread_time
      Duration

      From python, we can measure the wall clock time of the subprocess. I plan on using https://docs.python.org/3/library/timeit.html#timeit.default_timer

      Memory and duration metrics were completed in SERVER-67051

      Json Format:
      
      Note: for the action field, either the function name or command line will be used.
      {
       build_tasks: [{
      	 array_index: <int>(2),
      	 outputs: [<str>](2),
      	 inputs: [<str>](2),
      	 action: <str>(2),
       cpu_time: <float>(2),
       mem_usage: <long>(2),
      	 start_time: <datetime timestamp>(2),
      	 end_time: <datetime timestamp>(2)
      }]
      }
      
      

            Assignee:
            daniel.moody@mongodb.com Daniel Moody
            Reporter:
            daniel.moody@mongodb.com Daniel Moody
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: