OSDN Git Service

Fixed stop_run callback
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Wed, 14 May 2014 04:45:46 +0000 (13:45 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Wed, 14 May 2014 04:45:46 +0000 (13:45 +0900)
src/ltj-debug.lua
src/ltj-inputbuf.lua

index d4a084a..8c57eda 100644 (file)
@@ -104,8 +104,15 @@ do
    end
 
    local function print_measure()
+      local temp = {}
       for i,v in pairs(time_stat) do
-        print (i, tostring(v[1]) .. ' times', tostring(v[2]) .. ' sec.')
+        temp[#temp+1] = { i, v[1], v[2], v[2]/v[1] }
+      end
+      table.sort(temp, function (a,b) return (a[4]>b[4]) end)
+      print()
+      print('desc', 'ave.', 'times', 'total')
+      for _,v in ipairs(temp) do
+        print ((v[1] .. '                '):sub(1,16), v[4], v[2], v[3])
       end
    end
    if luatexja.base then
index 4651d05..fdf9dc8 100644 (file)
@@ -47,11 +47,4 @@ local function add_comment(buffer)
    return buffer
 end
 
-luatexbase.add_to_callback('process_input_buffer',
-   add_comment,'ltj.process_input_buffer')
-
-   luatexbase.add_to_callback('stop_run', function()
-                                print(time_line) 
-                                         end, 'adjust_icflag', 1)
-
 --EOF