26 #ifndef G4FastPathHadronicCrossSection_hh
27 #define G4FastPathHadronicCrossSection_hh
34 #include <unordered_map>
47 namespace G4FastPathHadronicCrossSection {
90 uint64_t cacheHitCount;
91 uint64_t initCyclesFastPath;
92 uint64_t invocationCountSlowPath;
93 uint64_t totalCyclesSlowPath;
94 uint64_t invocationCountFastPath;
95 uint64_t totalCyclesFastPath;
96 uint64_t invocationCountTriedOneLineCache;
97 uint64_t invocationCountOneLineCache;
114 uint64_t methodCalled;
115 uint64_t hitOneLineCache;
118 uint64_t sampleZandA;
134 return (lhs.first==rhs.first)&&(lhs.second == rhs.second);
147 std::less<G4CrossSectionDataStore_Key>
less;
196 static inline void logTiming( cycleCountEntry* , fastPathEntry* , timing& );
203 namespace G4FastPathHadronicCrossSection {
207 if ( cl !=
nullptr ) ++(cl->invocationCountTriedOneLineCache);
210 if ( cl !=
nullptr ) ++(cl->invocationCountOneLineCache);
212 inline void logHit(cycleCountEntry* cl) {
213 if ( cl !=
nullptr ) ++(cl->cacheHitCount);
217 if ( cl !=
nullptr ) ++(cl->invocationCountFastPath);
221 if ( cl !=
nullptr ) ++(cl->invocationCountSlowPath);
226 if ( cl !=
nullptr ) cl->initCyclesFastPath = tm.rdtsc_stop - tm.rdtsc_start;
230 if ( cl!=
nullptr ) cl->totalCyclesFastPath = tm.rdtsc_stop - tm.rdtsc_start;
234 if ( cl!=
nullptr ) cl->totalCyclesSlowPath = tm.rdtsc_stop - tm.rdtsc_start;
236 inline void logTiming( cycleCountEntry* entry , fastPathEntry* fast_entry, timing& timing)
238 if (fast_entry !=
nullptr ) {
239 if ( entry->invocationCountFastPath == 0 ) {
303 os<<
"#DEBUG COUNTERS: count="<<fp.count<<
" slowpath_sum="<<fp.slowpath_sum<<
" max_delta="<<fp.max_delta;
304 os<<
" min_delta="<<fp.min_delta<<
" sum_delta="<<fp.sum_delta<<
" sum_delta_square="<<fp.sum_delta_square<<
"\n";
310 #endif //G4FastPathHadronicCrossSection_hh
static void logTotalCyclesFastPath(cycleCountEntry *, timing &)
static constexpr double MeV
std::ostream & operator<<(std::ostream &, const BasicVector3D< float > &)
std::less< G4CrossSectionDataStore_Key > less
void logStopCountCycles(timing &)
const G4String & GetParticleName() const
const G4ParticleDefinition *const particle
G4bool initializationPhase
G4double Value(G4double theEnergy, size_t &lastidx) const
void Initialize(G4CrossSectionDataStore *)
std::unordered_map< G4CrossSectionDataStore_Key, cycleCountEntry *, G4CrossSectionDataStore_Key_Hash, G4CrossSectionDataStore_Key_EqualTo > G4CrossSectionDataStore_Cache
G4bool prevCalcUsedFastPath
bool operator()(const G4CrossSectionDataStore_Key &lhs, const G4CrossSectionDataStore_Key &rhs) const
const G4String & GetName() const
static void logInvocationOneLine(cycleCountEntry *)
const G4double min_cutoff
static constexpr double MeV
std::set< fastPathRequestConfig_t, fastPathRequestConfig_Less > G4CrossSectionDataStore_Requests
static void logInvocationCountFastPath(cycleCountEntry *)
G4bool useFastPathIfAvailable
static void logInitCyclesFastPath(cycleCountEntry *, timing &)
size_t operator()(const G4CrossSectionDataStore_Key &x) const
static void logInvocationCountSlowPAth(cycleCountEntry *)
static void logInvocationTriedOneLine(cycleCountEntry *)
std::pair< const G4ParticleDefinition *, const G4Material * > G4CrossSectionDataStore_Key
unsigned long long rdtsc_stop
static void logHit(cycleCountEntry *)
fastPathEntry(const G4ParticleDefinition *par, const G4Material *mat, G4double min_cutoff)
cycleCountEntry(const G4String &pname, const G4Material *mat)
G4double GetCrossSection(G4double ene) const
static void logTotalCyclesSlowPath(cycleCountEntry *, timing &)
const G4Material *const material
static void logTiming(cycleCountEntry *, fastPathEntry *, timing &)
unsigned long long rdtsc_start
G4CrossSectionDataStore_Key part_mat
bool operator()(const fastPathRequestConfig_t &lhs, const fastPathRequestConfig_t &rhs) const
std::hash< uint64_t > hash_uint64_t
void logStartCountCycles(timing &)
const G4String & particle
const G4Material *const material