@@ -6,6 +6,7 @@ local AB = E:GetModule('ActionBars')
6
6
local type , pairs , sort , tonumber = type , pairs , sort , tonumber
7
7
local lower , wipe , next , print = strlower , wipe , next , print
8
8
local ipairs , format , tinsert = ipairs , format , tinsert
9
+ local strmatch , gsub = strmatch , gsub
9
10
10
11
local CopyTable = CopyTable
11
12
local ReloadUI = ReloadUI
79
80
local text = ' '
80
81
81
82
function E :BuildProfilerText (tbl , data , overall )
83
+ local full = not overall or overall == 2
82
84
for _ , info in ipairs (tbl ) do
83
85
if info .key == ' _module' then
84
- local all = E .profiler .data ._all
86
+ local all = E .Profiler .data ._all
85
87
if all then
86
88
local total = info .total or 0
87
89
local percent = (total / all .total ) * 100
88
90
text = format (' %s%s > count: %d | total: %0.2fms (addon %0.2f%%)\n ' , text , info .module or ' ' , info .count or 0 , total , percent )
89
91
end
90
- elseif not overall then
92
+ elseif full then
91
93
local total = info .total or 0
92
94
local modulePercent = (total / data ._module .total ) * 100
93
95
94
- local all , allPercent = E .profiler .data ._all
96
+ local all , allPercent = E .Profiler .data ._all
95
97
if all then
96
98
allPercent = (total / all .total ) * 100
97
99
end
100
102
end
101
103
end
102
104
103
- if not overall then
105
+ if full then
104
106
text = format (' %s\n ' , text )
105
107
end
106
108
145
147
146
148
function E :GetProfilerData (msg )
147
149
local switch = lower (msg )
148
- if switch ~= ' ' then
149
- if switch == ' e' then
150
- local data = E .profiler .data [E ]
150
+ if switch == ' ' then return end
151
+
152
+ local ouf = switch == ' ouf'
153
+ if ouf or switch == ' e' then
154
+ local data = E .Profiler .data [ouf and E .oUF or E ]
155
+ if data then
156
+ E :Dump (data , true )
157
+ end
158
+ elseif switch == ' pooler' then
159
+ local data = E .Profiler .data [E .oUF .Pooler ]
160
+ if data then
161
+ E :Dump (data , true )
162
+ end
163
+ elseif strmatch (switch , ' ^ouf%s+' ) then
164
+ local element = gsub (switch , ' ^ouf%s+' , ' ' )
165
+ if element == ' ' then return end
166
+
167
+ for key , module in next , E .oUF .elements do
168
+ local data = element == lower (key ) and E .Profiler .data [module ]
151
169
if data then
152
170
E :Dump (data , true )
153
171
end
154
- else
155
- for key , module in next , E . modules do
156
- local data = switch == lower ( key ) and E . profiler . data [ module ]
157
- if data then
158
- E : Dump ( data , true )
159
- end
172
+ end
173
+ else
174
+ for key , module in next , E . modules do
175
+ local data = switch == lower ( key ) and E . Profiler . data [ module ]
176
+ if data then
177
+ E : Dump ( data , true )
160
178
end
161
179
end
162
180
end
163
181
end
164
182
165
183
local function FetchAll (overall )
166
- local data = E .profiler .data [E ]
167
- if data then
168
- E :SortProfilerData (' E' , data , overall )
169
- end
184
+ if overall == 2 then
185
+ local ouf = E .Profiler .data [E .oUF ]
186
+ if ouf then
187
+ E :SortProfilerData (' oUF' , ouf , overall )
188
+ end
189
+
190
+ local private = E .Profiler .oUF_Private -- this is special
191
+ if private then
192
+ E :SortProfilerData (' oUF.Private' , private , overall )
193
+ end
170
194
171
- for key , module in next , E .modules do
172
- local info = E .profiler .data [module ]
173
- if info then
174
- E :SortProfilerData (key , info , overall )
195
+ local pooler = E .Profiler .data [E .oUF .Pooler ]
196
+ if pooler then
197
+ E :SortProfilerData (' oUF.Pooler' , pooler , overall )
198
+ end
199
+
200
+ for key , module in next , E .oUF .elements do
201
+ local info = E .Profiler .data [module ]
202
+ if info then
203
+ E :SortProfilerData (key , info , overall )
204
+ end
205
+ end
206
+ else
207
+ local data = E .Profiler .data [E ]
208
+ if data then
209
+ E :SortProfilerData (' E' , data , overall )
210
+ end
211
+
212
+ local ouf = overall and E .Profiler .data [E .oUF ]
213
+ if ouf then
214
+ E :SortProfilerData (' oUF' , ouf , overall )
215
+ end
216
+
217
+ for key , module in next , E .modules do
218
+ local info = E .Profiler .data [module ]
219
+ if info then
220
+ E :SortProfilerData (key , info , overall )
221
+ end
175
222
end
176
223
end
177
224
end
180
227
local switch = lower (msg )
181
228
if switch ~= ' ' then
182
229
if switch == ' reset' then
183
- E .profiler .reset ()
230
+ E .Profiler .reset ()
184
231
185
232
return E :Print (' Reset profiler.' )
186
233
elseif switch == ' all' then
187
- FetchAll (true )
234
+ FetchAll (1 )
235
+ elseif switch == ' ouf' then
236
+ FetchAll (2 )
188
237
elseif switch == ' e' then
189
- local data = E .profiler .data [E ]
238
+ local data = E .Profiler .data [E ]
190
239
if data then
191
240
E :SortProfilerData (' E' , data )
192
241
end
242
+ elseif switch == ' ouf' then
243
+ local data = E .Profiler .data [E .oUF ]
244
+ if data then
245
+ E :SortProfilerData (' oUF' , data )
246
+ end
247
+ elseif switch == ' pooler' then
248
+ local data = E .Profiler .data [E .oUF .Pooler ]
249
+ if data then
250
+ E :SortProfilerData (' oUF.Pooler' , data )
251
+ end
252
+ elseif strmatch (switch , ' ^ouf%s+' ) then
253
+ local element = gsub (switch , ' ^ouf%s+' , ' ' )
254
+ if element ~= ' ' then
255
+ for key , module in next , E .oUF .elements do
256
+ local data = element == lower (key ) and E .Profiler .data [module ]
257
+ if data then
258
+ E :SortProfilerData (key , data )
259
+
260
+ break
261
+ end
262
+ end
263
+ end
193
264
else
194
265
for key , module in next , E .modules do
195
- local data = switch == lower (key ) and E .profiler .data [module ]
266
+ local data = switch == lower (key ) and E .Profiler .data [module ]
196
267
if data then
197
268
E :SortProfilerData (key , data )
198
269
0 commit comments