ThreadTools Class Reference

This reference page is linked to from the following overview topics: Thread Tools.



Detailed Description

This class lets control the amount of threading in different parts of Max */.

#include <PerformanceTools.h>

Inheritance diagram for ThreadTools:
Inheritance graph
[legend]

List of all members.

Public Types

enum   ThreadType { kMeshThreading = 0, kDeformationThreading, kHWMeshCreationThreading, kEndThreading }

Public Member Functions

UtilExport unsigned int  GetNumberOfThreads (ThreadType threadType, unsigned int numberElements)
  This method returns the actual number of threads to be used for a particular task depending on the number of elements.

Static Public Member Functions

static UtilExport void  SetNumberOfThreads (ThreadType threadType, unsigned int maxNumThreads, unsigned int minElementsPerThread)
  This method lets you set the number of threads on various parts of Max.
static UtilExport unsigned int  GetNumberOfThreads (ThreadType threadType)
  This method returns the maximum number of threads on various parts used by Max.
static UtilExport unsigned int  GetMinNumberElements (ThreadType threadType)
  This method returns the minimum number elements in each threads on various parts used by Max.

Member Enumeration Documentation

Enumerator:
kMeshThreading 
kDeformationThreading 
kHWMeshCreationThreading 
kEndThreading 
                            { kMeshThreading = 0, //the internal threading to mesh this mainly building normals, some clip operations, and vec normalization
                   kDeformationThreading,         //this controls the threading of the simple deformation class that is used by modifiers like bend, skin, skinwrap etc 
                   kHWMeshCreationThreading, //this the numbers of threads used to create the DirectX hardware meshes
                   kEndThreading // do not use this just signifies the end of the enumeration.  Insert any new enumeration above this one
                 } ;

Member Function Documentation

static UtilExport void SetNumberOfThreads ( ThreadType  threadType,
unsigned int  maxNumThreads,
unsigned int  minElementsPerThread 
) [static]

This method lets you set the number of threads on various parts of Max.

This method lets you set the maximum number of threads on various parts of Max. It also lets you set the minimum number of elements for each thread to prevent excessiving threading. It does not prevent you from oversubscribing threads.

Parameters:
[in] threadType this is which part of Max you want to set the multi-thread level
[in] maxNumThreads this is the maximum number of threads to use for this operation. This is not limited so you can over subscribe and have more threads than CPUs.
[in] minElementsPerThread this is used to restrict the number of threads. It controls the number of threads to use limited by maxNumThreads. The number of threads used equal to numberElements/minElementsPerThread. So for instance the KMeshThreads in the elements are the faces/vertices. This is here to prevent too few elements per thread. If set to 0 or less this value will be ignored and the numThreads will be used.
static UtilExport unsigned int GetNumberOfThreads ( ThreadType  threadType ) [static]

This method returns the maximum number of threads on various parts used by Max.

This method returns the maximum number of threads on various parts of used by Max.

Parameters:
[in] threadType this is which part of Max you want to set the multi-thread level
static UtilExport unsigned int GetMinNumberElements ( ThreadType  threadType ) [static]

This method returns the minimum number elements in each threads on various parts used by Max.

This method returns the minimum number elements in each threads on various parts used by Max

Parameters:
[in] threadType this is which part of Max you want to set the multi-thread level
UtilExport unsigned int GetNumberOfThreads ( ThreadType  threadType,
unsigned int  numberElements 
)

This method returns the actual number of threads to be used for a particular task depending on the number of elements.

This method returns the actual number of threads to be used for a particular task depending on the number of elements

Parameters:
[in] threadType this is which part of Max you want to get the multi-thread level
[in] numberElements is the number of elements in the loop to thread

ThreadTools ThreadTools ThreadTools ThreadTools ThreadTools ThreadTools ThreadTools ThreadTools ThreadTools ThreadTools
ThreadTools ThreadTools ThreadTools ThreadTools ThreadTools ThreadTools ThreadTools ThreadTools ThreadTools ThreadTools