Suspend spawned process and resume just before count / sampling start

Description

We may in some rare cases miss the short process run with wperf.
We want to create process suspended and resume it with

Definition of done

  • Check if this approach is meaningful. And see below “semi-skimmed” solution for this:

  • Add CREATE_SUSPENDED flag to CreateProcess() in SpawnProcess() function in process_api.h. See :

CREATE_SUSPENDED 0x00000004

The primary thread of the new process is created in a suspended state, and does not run until the ResumeThread function is called.

  • Resume process with ResumeThread() function. See

Activity

Show:

Przemyslaw Wirkus June 4, 2024 at 11:46 AM

Sampling findings

Ne bonefit reducing delays in SpawnProcess() or using:

I will close the ticket in this case, as we are doing well spawning our process.

Przemyslaw Wirkus June 4, 2024 at 11:20 AM

Regarding sampling

We need process to create e.g. module table while it starts, so creating suspended process will not allow us to e.g. get information about modules (or at least there will be race). You can see example with explanation in this blog:

Rationale

I do not see any reason for us to suspend/resume spawned process as there will be no real gains from it. Looking at the code we start sampling just after we obtain image address and module information from running process.

Przemyslaw Wirkus June 4, 2024 at 11:18 AM

I’ve added process spawn / resume thread to counting:

Results, no speed up for startup time. We start counting exactly after we run process. See measurements:

With change:

Before change

Won't Fix

Details

Assignee

Reporter

Components

Sprint

Fix versions

Priority

Checklist

Sentry

Created December 23, 2023 at 12:05 AM
Updated June 4, 2024 at 11:47 AM
Resolved June 4, 2024 at 11:47 AM