PerformanceTools.h

Go to the documentation of this file.
00001 //**************************************************************************/
00002 // Copyright (c) 1998-2008 Autodesk, Inc.
00003 // All rights reserved.
00004 // 
00005 // These coded instructions, statements, and computer programs contain
00006 // unpublished proprietary information written by Autodesk, Inc., and are
00007 // protected by Federal copyright law. They may not be disclosed to third
00008 // parties or copied or duplicated in any form, in whole or in part, without
00009 // the prior written consent of Autodesk, Inc.
00010 //**************************************************************************/
00011 // DESCRIPTION: PerformanceTools (namespace)
00012 //              Tools to track performance counters and thread settings
00013 // AUTHOR:  Peter Watje -  April 22, 2008
00014 //          
00015 //***************************************************************************/
00016 #pragma once
00017 
00018 #include "MaxHeap.h"
00019 #include <WTypes.h>
00020 
00021 namespace MaxSDK 
00022 {
00023     namespace PerformanceTools 
00024     {
00025 
00027         class ThreadTools : public MaxHeapOperators
00028         {
00029         public:
00030             enum ThreadType { kMeshThreading = 0, //the internal threading to mesh this mainly building normals, some clip operations, and vec normalization
00031                    kDeformationThreading,         //this controls the threading of the simple deformation class that is used by modifiers like bend, skin, skinwrap etc 
00032                    kHWMeshCreationThreading, //this the numbers of threads used to create the DirectX hardware meshes
00033                    kEndThreading // do not use this just signifies the end of the enumeration.  Insert any new enumeration above this one
00034                  } ;
00035 
00036 
00038 
00048             UtilExport static void SetNumberOfThreads(ThreadType threadType, unsigned int maxNumThreads, unsigned int minElementsPerThread);
00050 
00053             UtilExport static unsigned int GetNumberOfThreads(ThreadType threadType);
00055 
00058             UtilExport static unsigned int GetMinNumberElements(ThreadType threadType);
00059 
00061 
00065             UtilExport unsigned int GetNumberOfThreads(ThreadType threadType, unsigned int numberElements);
00066 
00067 
00068 
00069 
00070 
00071 
00072         };
00073 
00074 
00075 
00077         class Timer : public MaxHeapOperators
00078         {
00079         public:
00080     
00082             UtilExport void StartTimer();
00084             UtilExport double EndTimer();
00085 
00088             UtilExport static void StartTimerGlobal(unsigned int id);
00090             UtilExport static double EndTimerGlobal(unsigned int id);
00092             UtilExport static void ClearTimerGlobal(unsigned int id);
00094             UtilExport static double GetTimerGlobal(unsigned int id);
00095 
00096 
00097         private:
00098             LARGE_INTEGER mStartTime, mEndTime;
00099 
00100         };
00101 
00102     }
00103 }
00104