OLD | NEW |
1 //===- subzero/src/IceGlobalContext.cpp - Global context defs -------------===// | 1 //===- subzero/src/IceGlobalContext.cpp - Global context defs -------------===// |
2 // | 2 // |
3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 /// | 9 /// |
10 /// \file | 10 /// \file |
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 void GlobalContext::dumpStats(const Cfg *Func) { | 959 void GlobalContext::dumpStats(const Cfg *Func) { |
960 if (!getFlags().getDumpStats()) | 960 if (!getFlags().getDumpStats()) |
961 return; | 961 return; |
962 if (Func == nullptr) { | 962 if (Func == nullptr) { |
963 getStatsCumulative()->dump(Func, this); | 963 getStatsCumulative()->dump(Func, this); |
964 } else { | 964 } else { |
965 ICE_TLS_GET_FIELD(TLS)->StatsFunction.dump(Func, this); | 965 ICE_TLS_GET_FIELD(TLS)->StatsFunction.dump(Func, this); |
966 } | 966 } |
967 } | 967 } |
968 | 968 |
| 969 void GlobalContext::mergeTimersFromTLS() { |
| 970 getTimers()->mergeFrom(ICE_TLS_GET_FIELD(TLS)->Timers); |
| 971 } |
| 972 |
969 void GlobalContext::dumpTimers(TimerStackIdT StackID, bool DumpCumulative) { | 973 void GlobalContext::dumpTimers(TimerStackIdT StackID, bool DumpCumulative) { |
970 if (!BuildDefs::timers()) | 974 if (!BuildDefs::timers()) |
971 return; | 975 return; |
972 auto Timers = getTimers(); | 976 auto Timers = getTimers(); |
973 assert(Timers->size() > StackID); | 977 assert(Timers->size() > StackID); |
974 OstreamLocker L(this); | 978 OstreamLocker L(this); |
975 Timers->at(StackID).dump(getStrDump(), DumpCumulative); | 979 Timers->at(StackID).dump(getStrDump(), DumpCumulative); |
976 } | 980 } |
977 | 981 |
978 LockedPtr<StringPool> | 982 LockedPtr<StringPool> |
979 GlobalStringPoolTraits::getStrings(const GlobalContext *PoolOwner) { | 983 GlobalStringPoolTraits::getStrings(const GlobalContext *PoolOwner) { |
980 return PoolOwner->getStrings(); | 984 return PoolOwner->getStrings(); |
981 } | 985 } |
982 | 986 |
983 TimerIdT TimerMarker::getTimerIdFromFuncName(GlobalContext *Ctx, | 987 TimerIdT TimerMarker::getTimerIdFromFuncName(GlobalContext *Ctx, |
984 const std::string &FuncName) { | 988 const std::string &FuncName) { |
985 if (!BuildDefs::timers()) | 989 if (!BuildDefs::timers()) |
986 return 0; | 990 return 0; |
987 if (!getFlags().getTimeEachFunction()) | 991 if (!getFlags().getTimeEachFunction()) |
988 return 0; | 992 return 0; |
989 return Ctx->getTimerID(GlobalContext::TSK_Funcs, FuncName); | 993 return Ctx->getTimerID(GlobalContext::TSK_Funcs, FuncName); |
990 } | 994 } |
991 | 995 |
992 void TimerMarker::push() { | 996 void TimerMarker::push() { |
993 switch (StackID) { | 997 switch (StackID) { |
994 case GlobalContext::TSK_Default: | 998 case GlobalContext::TSK_Default: |
995 Active = getFlags().getSubzeroTimingEnabled(); | 999 Active = getFlags().getSubzeroTimingEnabled() || |
| 1000 !getFlags().getTimingFocusOn().empty(); |
996 break; | 1001 break; |
997 case GlobalContext::TSK_Funcs: | 1002 case GlobalContext::TSK_Funcs: |
998 Active = getFlags().getTimeEachFunction(); | 1003 Active = getFlags().getTimeEachFunction(); |
999 break; | 1004 break; |
1000 default: | 1005 default: |
1001 break; | 1006 break; |
1002 } | 1007 } |
1003 if (Active) | 1008 if (Active) |
1004 Ctx->pushTimer(ID, StackID); | 1009 Ctx->pushTimer(ID, StackID); |
1005 } | 1010 } |
1006 | 1011 |
1007 void TimerMarker::pushCfg(const Cfg *Func) { | 1012 void TimerMarker::pushCfg(const Cfg *Func) { |
1008 Ctx = Func->getContext(); | 1013 Ctx = Func->getContext(); |
1009 Active = Func->getFocusedTiming() || getFlags().getSubzeroTimingEnabled(); | 1014 Active = Func->getFocusedTiming() || getFlags().getSubzeroTimingEnabled(); |
1010 if (Active) | 1015 if (Active) |
1011 Ctx->pushTimer(ID, StackID); | 1016 Ctx->pushTimer(ID, StackID); |
1012 } | 1017 } |
1013 | 1018 |
1014 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); | 1019 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); |
1015 | 1020 |
1016 } // end of namespace Ice | 1021 } // end of namespace Ice |
OLD | NEW |