Skip to content

Optimize calling GetTotalWorkerThreadPoolCompletionCount #1079

@billwert

Description

@billwert

@ninedan reported that calling GetTotalThreadPoolCompletionCount is costing ~0.62% of all CPU usage in a large server scenario. It looks like we can easily move the following lines inside the check to for the thread adjustment interval, only paying this cost when we might use the answer.

@kouvel what do you think?

DWORD currentTicks = GetTickCount();
LONG totalNumCompletions = (LONG)Thread::GetTotalWorkerThreadPoolCompletionCount();
LONG numCompletions = totalNumCompletions - VolatileLoad(&PriorCompletedWorkRequests);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions