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 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
903 assert(StackID < Timers->size()); | 903 assert(StackID < Timers->size()); |
904 Timers->at(StackID).pop(ID); | 904 Timers->at(StackID).pop(ID); |
905 } | 905 } |
906 | 906 |
907 void GlobalContext::resetTimer(TimerStackIdT StackID) { | 907 void GlobalContext::resetTimer(TimerStackIdT StackID) { |
908 auto Timers = &ICE_TLS_GET_FIELD(TLS)->Timers; | 908 auto Timers = &ICE_TLS_GET_FIELD(TLS)->Timers; |
909 assert(StackID < Timers->size()); | 909 assert(StackID < Timers->size()); |
910 Timers->at(StackID).reset(); | 910 Timers->at(StackID).reset(); |
911 } | 911 } |
912 | 912 |
913 std::string GlobalContext::getTimerName(TimerStackIdT StackID) { | |
914 auto Timers = &ICE_TLS_GET_FIELD(TLS)->Timers; | |
John
2016/04/06 13:05:32
Auto *
Jim Stichnoth
2016/04/06 13:23:58
Done.
| |
915 assert(StackID < Timers->size()); | |
916 return Timers->at(StackID).getName(); | |
917 } | |
918 | |
913 void GlobalContext::setTimerName(TimerStackIdT StackID, | 919 void GlobalContext::setTimerName(TimerStackIdT StackID, |
914 const std::string &NewName) { | 920 const std::string &NewName) { |
915 auto Timers = &ICE_TLS_GET_FIELD(TLS)->Timers; | 921 auto Timers = &ICE_TLS_GET_FIELD(TLS)->Timers; |
916 assert(StackID < Timers->size()); | 922 assert(StackID < Timers->size()); |
917 Timers->at(StackID).setName(NewName); | 923 Timers->at(StackID).setName(NewName); |
918 } | 924 } |
919 | 925 |
920 // Note: optQueueBlockingPush and optQueueBlockingPop use unique_ptr at the | 926 // Note: optQueueBlockingPush and optQueueBlockingPop use unique_ptr at the |
921 // interface to take and transfer ownership, but they internally store the raw | 927 // interface to take and transfer ownership, but they internally store the raw |
922 // Cfg pointer in the work queue. This allows e.g. future queue optimizations | 928 // Cfg pointer in the work queue. This allows e.g. future queue optimizations |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
955 void GlobalContext::dumpStats(const Cfg *Func) { | 961 void GlobalContext::dumpStats(const Cfg *Func) { |
956 if (!getFlags().getDumpStats()) | 962 if (!getFlags().getDumpStats()) |
957 return; | 963 return; |
958 if (Func == nullptr) { | 964 if (Func == nullptr) { |
959 getStatsCumulative()->dump(Func, this); | 965 getStatsCumulative()->dump(Func, this); |
960 } else { | 966 } else { |
961 ICE_TLS_GET_FIELD(TLS)->StatsFunction.dump(Func, this); | 967 ICE_TLS_GET_FIELD(TLS)->StatsFunction.dump(Func, this); |
962 } | 968 } |
963 } | 969 } |
964 | 970 |
965 void GlobalContext::mergeTimersFromTLS() { | |
966 getTimers()->mergeFrom(ICE_TLS_GET_FIELD(TLS)->Timers); | |
967 } | |
968 | |
969 void GlobalContext::dumpTimers(TimerStackIdT StackID, bool DumpCumulative) { | 971 void GlobalContext::dumpTimers(TimerStackIdT StackID, bool DumpCumulative) { |
970 if (!BuildDefs::timers()) | 972 if (!BuildDefs::timers()) |
971 return; | 973 return; |
972 auto Timers = getTimers(); | 974 auto Timers = getTimers(); |
973 assert(Timers->size() > StackID); | 975 assert(Timers->size() > StackID); |
974 OstreamLocker L(this); | 976 OstreamLocker L(this); |
975 Timers->at(StackID).dump(getStrDump(), DumpCumulative); | 977 Timers->at(StackID).dump(getStrDump(), DumpCumulative); |
976 } | 978 } |
977 | 979 |
980 void GlobalContext::dumpLocalTimers(TimerStackIdT StackID, | |
981 bool DumpCumulative) { | |
982 if (!BuildDefs::timers()) | |
983 return; | |
984 auto Timers = &ICE_TLS_GET_FIELD(TLS)->Timers; | |
John
2016/04/06 13:05:32
Auto *
Jim Stichnoth
2016/04/06 13:23:58
Done.
| |
985 assert(Timers->size() > StackID); | |
986 OstreamLocker L(this); | |
987 Timers->at(StackID).dump(getStrDump(), DumpCumulative); | |
988 } | |
989 | |
978 LockedPtr<StringPool> | 990 LockedPtr<StringPool> |
979 GlobalStringPoolTraits::getStrings(const GlobalContext *PoolOwner) { | 991 GlobalStringPoolTraits::getStrings(const GlobalContext *PoolOwner) { |
980 return PoolOwner->getStrings(); | 992 return PoolOwner->getStrings(); |
981 } | 993 } |
982 | 994 |
983 TimerIdT TimerMarker::getTimerIdFromFuncName(GlobalContext *Ctx, | 995 TimerIdT TimerMarker::getTimerIdFromFuncName(GlobalContext *Ctx, |
984 const std::string &FuncName) { | 996 const std::string &FuncName) { |
985 if (!BuildDefs::timers()) | 997 if (!BuildDefs::timers()) |
986 return 0; | 998 return 0; |
987 if (!getFlags().getTimeEachFunction()) | 999 if (!getFlags().getTimeEachFunction()) |
(...skipping 20 matching lines...) Expand all Loading... | |
1008 void TimerMarker::pushCfg(const Cfg *Func) { | 1020 void TimerMarker::pushCfg(const Cfg *Func) { |
1009 Ctx = Func->getContext(); | 1021 Ctx = Func->getContext(); |
1010 Active = Func->getFocusedTiming() || getFlags().getSubzeroTimingEnabled(); | 1022 Active = Func->getFocusedTiming() || getFlags().getSubzeroTimingEnabled(); |
1011 if (Active) | 1023 if (Active) |
1012 Ctx->pushTimer(ID, StackID); | 1024 Ctx->pushTimer(ID, StackID); |
1013 } | 1025 } |
1014 | 1026 |
1015 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); | 1027 ICE_TLS_DEFINE_FIELD(GlobalContext::ThreadContext *, GlobalContext, TLS); |
1016 | 1028 |
1017 } // end of namespace Ice | 1029 } // end of namespace Ice |
OLD | NEW |