00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // $Id$ 00027 // 00028 // -------------------------------------------------------------------- 00029 // GEANT 4 class header file 00030 // 00031 // G4SmartVoxelStat 00032 // 00033 // Class description: 00034 // 00035 // Stores information on the performance of the smart voxel algorithm 00036 // for an individual logical volume. 00037 00038 // Author: D.C.Williams, UCSC (davidw@scipp.ucsc.edu) 00039 // -------------------------------------------------------------------- 00040 00041 #ifndef G4SmartVoxelStat_hh 00042 #define G4SmartVoxelStat_hh 00043 00044 #include "G4Types.hh" 00045 #include <functional> 00046 00047 class G4LogicalVolume; 00048 class G4SmartVoxelHeader; 00049 00050 class G4SmartVoxelStat 00051 { 00052 public: // with description 00053 00054 G4SmartVoxelStat( const G4LogicalVolume *theVolume, 00055 const G4SmartVoxelHeader *theVoxel, 00056 G4double theSysTime, 00057 G4double theUserTime ); 00058 // Construct information on one volume's voxels 00059 00060 const G4LogicalVolume *GetVolume() const; 00061 // Return a pointer to the logical volume 00062 00063 const G4SmartVoxelHeader *GetVoxel() const; 00064 // Return a pointer to the voxel header 00065 00066 G4double GetSysTime() const; 00067 // Get amount of system CPU time needed to build voxels 00068 00069 G4double GetUserTime() const; 00070 // Get amount of user CPU time needed to build voxels 00071 00072 G4double GetTotalTime() const; 00073 // Get total amount of CPU time needed to build voxels 00074 00075 G4long GetNumberHeads() const; 00076 // Get number of voxel headers used in the volume 00077 00078 G4long GetNumberNodes() const; 00079 // Get number of voxel slices used in the volume 00080 00081 G4long GetNumberPointers() const; 00082 // Get number of voxel proxy pointers used in the volume 00083 00084 G4long GetMemoryUse() const; 00085 // Get number of bytes needed to store voxel information 00086 00087 00088 protected: 00089 00090 void CountHeadsAndNodes( const G4SmartVoxelHeader *head ); 00091 00092 const G4LogicalVolume *volume; 00093 const G4SmartVoxelHeader *voxel; 00094 00095 G4double sysTime; 00096 G4double userTime; 00097 00098 G4long heads; 00099 G4long nodes; 00100 G4long pointers; 00101 00102 00103 public: 00104 00105 // 00106 // Functor objects for sorting 00107 // 00108 struct ByCpu 00109 : public std::binary_function< const G4SmartVoxelStat, 00110 const G4SmartVoxelStat, G4bool > 00111 { 00112 G4bool operator()( const G4SmartVoxelStat &a, const G4SmartVoxelStat &b ) 00113 { 00114 return a.GetTotalTime() > b.GetTotalTime(); 00115 } 00116 }; 00117 00118 struct ByMemory 00119 : public std::binary_function< const G4SmartVoxelStat, 00120 const G4SmartVoxelStat, G4bool > 00121 { 00122 G4bool operator()( const G4SmartVoxelStat &a, const G4SmartVoxelStat &b ) 00123 { 00124 return a.GetMemoryUse() > b.GetMemoryUse(); 00125 } 00126 }; 00127 }; 00128 00129 #endif