Previous Thread
Next Thread
Print Thread
Page 2 of 2 1 2
#112303 - 01/23/18 10:25 PM Re: Compile stats [Re: Golden Child]  
Joined: Jul 2007
Posts: 195
Monotremata Offline
Senior Member
Monotremata  Offline
Senior Member

Joined: Jul 2007
Posts: 195
California
Ahh gotcha! Other than running Ultima its hard to tell whats he's doing on the Apple before firing it up.

#112495 - 02/05/18 11:59 AM Re: Compile stats [Re: Golden Child]  
Joined: Feb 2014
Posts: 127
Golden Child Offline
Senior Member
Golden Child  Offline
Senior Member

Joined: Feb 2014
Posts: 127
Some more silly compiling fun...

I am so enamored with lua that I thought, why not install ubuntu's lua so I can write lua scripts outside of mame.

After a "sudo apt-get install lua5.3" I can run a lua interpreter from a regular bash shell.

One of the things I like is to see what the progress is for a compile.

So why don't we pipe the output from a make to a lua script and add the seconds for fun:

This is a really simple one liner. We just get the current time and then read a line, and check the time.

Then we print the time since the compile started and then the line that was read.

Let's call it "lua_time.lua"
Code
l = os.time() while true do j = io.read() k = os.time() if j == nil then break else print(k-l, j) end end


You can try this code in the lua interpreter by launching the interpreter with "lua5.3" and then pasting the line.

Type a few test lines to see what happens.

Code
lua5.3
Lua 5.3.3  Copyright (C) 1994-2016 Lua.org, PUC-Rio
> l = os.time() while true do j = io.read() k = os.time() if j == nil then break else print(k-l, j) end end
hey
3	hey
this
5	this
works
9	works
> 


I press CTRL+D to signal the end of input and the while loop drops out since it reads nil.

Another CTRL+D will drop out of the lua interpreter.

Ok, so now we've seen that our one liner works. So let's see it in action:

Our command will be: "make -j4 | lua5.3 lua_time.lua | tee luatimemake.txt"


Code
~/Downloads/mame194_extract/mame$ make clean
GCC 7 detected
Cleaning genie
Cleaning...
make[1]: Entering directory '/home/customer/Downloads/mame194_extract/mame/src/devices/cpu/m68000'
Cleaning...
make[1]: Leaving directory '/home/customer/Downloads/mame194_extract/mame/src/devices/cpu/m68000'


~/Downloads/mame194_extract/mame$ make -j4 | lua5.3 lua_time.lua | tee luatimemake2.txt
0	GCC 7 detected
0	Creating obj/Release
0	Creating obj/Release/src/host
0	Creating obj/Release/src/host/lua-5.3.0/src
0	lapi.c
1	lauxlib.c
1	lbaselib.c
1	Converting src/mame/drivers/ymmu100.ppm...
2	make[1]: Entering directory '/home/customer/Downloads/mame194_extract/mame/src/devices/cpu/m68000'
4	lbitlib.c
4	lcode.c
4	lcorolib.c
4	Linking m68kmake...
5	lctype.c
5	ldblib.c
...etc


So after a run, we've got a file that has a log of the compile run with a time at the beginning of each line.

Let's write a little routine that opens that file, and reads it into a table where the keys are each line of the compiler output and the value is a table with two entries, the line number of the output and the time since the beginning of the compile:

Let's call this file: "lua_checktime_simple.lua".

We just match the line with the pattern (.+)\t(.+) which gets us two items separated by a tab character, and these get returned as a table since we wrap it in braces {}. We read a line into g, then set h = {"g:match("(.+)\t(.+)")}. h[1] will be the time, h[2] will be the compiler output line.

Then we make a new table using the compiler output line as the key with t[h[2]] = {}.

t[h[2]][1] = linenum sets the first entry to the current line number
t[h[2]][2] = h[1] sets the second entry to the time that we got from the match.

Code
function formattime(a) local min,sec = math.modf(a/60) return min..":"..string.format("%02.0f",sec*60) end

f = io.open("luatimemake.txt","rb")

linenum = 0
t = {} f:seek("set") g = f:read() while g ~= nil do h = {g:match("(.+)\t(.+)")} maxval = tonumber(h[1]) linenum = linenum + 1 if h[2] ~= nil then t[h[2]]={} t[h[2]][1]=linenum t[h[2]][2]=tonumber(h[1]) end g = f:read() end

itemcount = 0
for a,b in pairs(t) do itemcount = itemcount + 1 end
print("TOTAL ITEMS:" .. itemcount)

newcount = 0


starttime = os.time()


while true do

newline = io.read()
newcount = newcount + 1
if newline == nil then break end
newlinetime = os.time() - starttime
if t[newline] ~= nil then oldlinetime = t[newline][2] else oldlinetime = nil end

print (newline)

if oldlinetime == nil then print("*** line not found *** NEW >>> "..newline) else print("OLDTIME = " .. formattime(oldlinetime).." "..oldlinetime .. " NEWTIME = " .. formattime(newlinetime).." ".. newlinetime .. " COMPARISON = " .. string.format("%2.1f",(oldlinetime / newlinetime)*100) .."% ".. " ITEMCOUNT = " .. newcount .."/"..itemcount) end
end


And if we invoke this with: "make -j4 | lua5.3 lua_checktime_simple.lua"

Code
~/Downloads/mame194_extract/mame$ make -j4 | lua5.3 lua_checktime_simple.lua 
TOTAL ITEMS:8514
GCC 7 detected
OLDTIME = 0:00 0 NEWTIME = 0:00 0 COMPARISON = -nan%  ITEMCOUNT = 1/8514
Creating obj/Release
OLDTIME = 0:00 0 NEWTIME = 0:00 0 COMPARISON = -nan%  ITEMCOUNT = 2/8514
Creating obj/Release/src/host
OLDTIME = 0:00 0 NEWTIME = 0:00 0 COMPARISON = -nan%  ITEMCOUNT = 3/8514
Creating obj/Release/src/host/lua-5.3.0/src
OLDTIME = 0:00 0 NEWTIME = 0:00 0 COMPARISON = -nan%  ITEMCOUNT = 4/8514
lapi.c
OLDTIME = 0:00 0 NEWTIME = 0:00 0 COMPARISON = -nan%  ITEMCOUNT = 5/8514
lauxlib.c
OLDTIME = 0:00 0 NEWTIME = 0:01 1 COMPARISON = 0.0%  ITEMCOUNT = 6/8514
lbitlib.c
OLDTIME = 0:00 0 NEWTIME = 0:01 1 COMPARISON = 0.0%  ITEMCOUNT = 7/8514
lbaselib.c
OLDTIME = 0:00 0 NEWTIME = 0:01 1 COMPARISON = 0.0%  ITEMCOUNT = 8/8514
Converting src/mame/drivers/ymmu100.ppm...
OLDTIME = 0:00 0 NEWTIME = 0:01 1 COMPARISON = 0.0%  ITEMCOUNT = 9/8514
lcode.c
OLDTIME = 0:00 0 NEWTIME = 0:01 1 COMPARISON = 0.0%  ITEMCOUNT = 10/8514
lcorolib.c
OLDTIME = 0:00 0 NEWTIME = 0:01 1 COMPARISON = 0.0%  ITEMCOUNT = 11/8514
lctype.c
OLDTIME = 0:01 1 NEWTIME = 0:01 1 COMPARISON = 100.0%  ITEMCOUNT = 12/8514
ldblib.c
OLDTIME = 0:01 1 NEWTIME = 0:01 1 COMPARISON = 100.0%  ITEMCOUNT = 13/8514
ldebug.c
OLDTIME = 0:01 1 NEWTIME = 0:01 1 COMPARISON = 100.0%  ITEMCOUNT = 14/8514



Now I can load this baseline compiler log on another system and compare the cpu speed.

Just some silly fun...

#112579 - 02/11/18 05:57 PM Re: Compile stats [Re: Golden Child]  
Joined: Feb 2014
Posts: 127
Golden Child Offline
Senior Member
Golden Child  Offline
Senior Member

Joined: Feb 2014
Posts: 127
I wanted a progress bar when I compile so I added that, along with a "dog bark" to tell me when it's done:

Once you've made a reference file in "luatimemake.txt" you get a nice progress bar.

make -j4 | lua5.3 compile_progress.lua


Code
-- compile_progress.lua


function dogbark() for i = 1,5 do os.execute("play -q /usr/share/sounds/gnome/default/alerts/bark.ogg") end end
-- for dogbark to work you have to "sudo apt install sox"
dogbark()

function formattime(a) local min,sec = math.modf(a/60) return min..":"..string.format("%02.0f",sec*60) end

f = io.open("luatimemake.txt","rb")
fileout = io.open("luacompareoutput.txt","w")

function progressbar(size,fraction)
local numbars = math.floor((size-2)*(fraction))
local fracpart = ((size-2)*fraction)-numbars
--local onechar = string.sub("01234567890",math.floor(fracpart*10)+1,math.floor(fracpart*10)+1)
--local onechar = string.sub(".,;:-=+\\|/*#",math.floor(fracpart*10)+1,math.floor(fracpart*10)+1)
  local onechar = string.sub(".abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",math.floor(fracpart*53)+1,math.floor(fracpart*53)+1)
local numremain = (size-2)-numbars
if numbars >= size - 2 then onechar = "" end
  return "["..string.rep("#",numbars)..onechar..string.rep(".",numremain-string.len(onechar)).."]".." "..string.format("%6.2f%%",100*fraction) --..fracpart..numbars
end

-- for i =0,100,0.5 do print (i,progressbar(80,i/100),progressbar(10,i/100)) end

function pprint(a) fileout:write(a .. "\n") print(a) end
function printt(t) for a,b in pairs(t) do print (a,b) end end

function dumpstring(a) for k = 1,string.len(a) do print (k,string.format("%3d",string.byte(a,k)).." "..string.sub(a,k,k)) end end

function add_to_table_and_check_duplicate(linestr,timeval,t,linenum)
local linestr2
if linestr ~= nil then
-- print(linestr) 
  if t[linestr]~= nil then 
    t[linestr]["count"] = t[linestr]["count"]+1  
    linestr2 = linestr .. "<DUPLICATE LINE NUM=" .. t[linestr]["count"]..">" print(linestr) 
  end
  if t[linestr]==nil then t[linestr] ={linenum=linenum,timeval=tonumber(timeval),count=1 }
                     else t[linestr2]={linenum=linenum,timeval=tonumber(timeval),count=1 }
                        pprint ("Original at "..t[linestr]["linenum"].." Duplicate at "..linenum..":\""..linestr2.."\" origtime = "..t[linestr]["timeval"].." newtime = "..timeval) 
  end 
end 
if linestr2 ~= nil then return linestr2 else return linestr end
end

linenum = 0

arun_table = {} f:seek("set") g = f:read() 
while g ~= nil do 
timeval,linestr = g:match("(.-)\t(.*)") 

maxval = tonumber(timeval) 
linenum = linenum + 1 

add_to_table_and_check_duplicate(linestr,timeval,arun_table,linenum)

g = f:read() end

aitemcount = 0
for a,b in pairs(arun_table) do aitemcount = aitemcount + 1 end
print("TOTAL ITEMS:" .. aitemcount)

newcount = 0

brun_table = {}

starttime = os.time()

while true do

newline = io.read()
newcount = newcount + 1
if newline == nil then break end

if newline:match("\t") ~= nil then
  newlinetime,newline = newline:match("(.-)\t(.*)") 
else
  newlinetime = os.time() - starttime
end

newline = add_to_table_and_check_duplicate(newline,newlinetime,brun_table,newcount)

if arun_table[newline] ~= nil then oldlinetime = arun_table[newline]["timeval"] oldlinenum = arun_table[newline]["linenum"] else oldlinetime = nil end

pprint (newline)

if oldlinetime == nil then pprint("*** line not found *** NEW >>> "..newline) print(arun_table[newline]) else pprint("REF TIME A = " .. formattime(oldlinetime).." "..string.format("%4d",oldlinetime) .. " TIME B = " .. formattime(newlinetime).." ".. string.format("%4d",newlinetime) .. " SPEED = " .. string.format("%2.1f",(oldlinetime / newlinetime)*100) .."%".. " BCOUNT = " .. string.format("%4d",newcount) .."/"..string.format("%4d",aitemcount).." ".."ALINE = " .. string.format("%4d",oldlinenum) .."/"..string.format("%4d",aitemcount).." ".. progressbar(52,oldlinenum/aitemcount)) 
   brun_table[newline]["match"]=1
   arun_table[newline]["match"]=1
end
end

print("NOMATCH IN A")
for c,d in pairs(arun_table) do if arun_table[c]["match"]==nil then print ("NOMATCH A:"..c) end end
print("NOMATCH IN B")
for c,d in pairs(brun_table) do if brun_table[c]["match"]==nil then print ("NOMATCH B:"..c) end end

print("DUPLICATES IN A")
for c,d in pairs(arun_table) do if arun_table[c]["count"]>1 then print (arun_table[c]["count"].."x:".."\""..c.."\"") end end
print("DUPLICATES IN B")
for c,d in pairs(brun_table) do if brun_table[c]["count"]>1 then print (brun_table[c]["count"].."x:".."\""..c.."\"") end end

dogbark()


and the output looks like:

Code

GCC 7 detected
REF TIME A = 0:00    0 TIME B = 0:00    0 SPEED = -nan% BCOUNT =    2/8528 ALINE =    1/8528 [..................................................]   0.01%
Creating obj/Release
REF TIME A = 0:00    0 TIME B = 0:00    0 SPEED = -nan% BCOUNT =    3/8528 ALINE =    2/8528 [..................................................]   0.02%
Creating obj/Release/src/host
REF TIME A = 0:00    0 TIME B = 0:00    0 SPEED = -nan% BCOUNT =    4/8528 ALINE =    3/8528 [..................................................]   0.04%
Creating obj/Release/src/host/lua-5.3.0/src
REF TIME A = 0:00    0 TIME B = 0:00    0 SPEED = -nan% BCOUNT =    5/8528 ALINE =    4/8528 [a.................................................]   0.05%
lapi.c
REF TIME A = 0:00    0 TIME B = 0:00    0 SPEED = -nan% BCOUNT =    6/8528 ALINE =    5/8528 [a.................................................]   0.06%
lauxlib.c
REF TIME A = 0:00    0 TIME B = 0:00    0 SPEED = -nan% BCOUNT =    7/8528 ALINE =    6/8528 [a.................................................]   0.07%
lbaselib.c
REF TIME A = 0:00    0 TIME B = 0:00    0 SPEED = -nan% BCOUNT =    8/8528 ALINE =    7/8528 [b.................................................]   0.08%
lbitlib.c
REF TIME A = 0:00    0 TIME B = 0:00    0 SPEED = -nan% BCOUNT =    9/8528 ALINE =    8/8528 [b.................................................]   0.09%
Converting src/mame/drivers/ymmu100.ppm...
REF TIME A = 0:00    0 TIME B = 0:00    0 SPEED = -nan% BCOUNT =   10/8528 ALINE =    9/8528 [b.................................................]   0.11%
lcode.c

...

Compiling src/mame/mame.cpp...
REF TIME A = 69:59 4199 TIME B = 41:05 2465 SPEED = 170.3% BCOUNT = 8524/8528 ALINE = 8525/8528 [#################################################Z]  99.96%
Compiling generated/version.cpp...
REF TIME A = 69:59 4199 TIME B = 41:05 2465 SPEED = 170.3% BCOUNT = 8525/8528 ALINE = 8524/8528 [#################################################Y]  99.95%
Building driver list...
REF TIME A = 69:59 4199 TIME B = 41:05 2465 SPEED = 170.3% BCOUNT = 8526/8528 ALINE = 8526/8528 [#################################################Z]  99.98%
Compiling generated/mame/mame/drivlist.cpp...
REF TIME A = 70:00 4200 TIME B = 41:05 2465 SPEED = 170.4% BCOUNT = 8527/8528 ALINE = 8527/8528 [#################################################Z]  99.99%
Linking mame64...
REF TIME A = 70:04 4204 TIME B = 41:09 2469 SPEED = 170.3% BCOUNT = 8528/8528 ALINE = 8528/8528 [##################################################] 100.00%
NOMATCH IN A
NOMATCH A:Creating ../../../../linux_gcc/bin/x64/Release/mame_mame<DUPLICATE LINE NUM=3>
NOMATCH IN B
DUPLICATES IN A
2x:"Generating m6509 disassembler source file..."
2x:""
2x:"Generating deco16 disassembler source file..."
2x:"Generating m65ce02 disassembler source file..."
2x:"Generating n2a03 disassembler source file..."
2x:"Generating m6510 disassembler source file..."
2x:"Generating r65c02 disassembler source file..."
2x:"Generating m4510 disassembler source file..."
2x:"Generating m65c02 disassembler source file..."
2x:"Generating m6502 disassembler source file..."
3x:"Creating ../../../../linux_gcc/bin/x64/Release/mame_mame"
2x:"Generating m740 disassembler source file..."
DUPLICATES IN B
2x:"Generating m6509 disassembler source file..."
2x:""
2x:"Generating deco16 disassembler source file..."
2x:"Generating m65ce02 disassembler source file..."
2x:"Generating n2a03 disassembler source file..."
2x:"Generating m6510 disassembler source file..."
2x:"Generating m740 disassembler source file..."
2x:"Generating r65c02 disassembler source file..."
2x:"Generating m4510 disassembler source file..."
2x:"Generating m6502 disassembler source file..."
2x:"Creating ../../../../linux_gcc/bin/x64/Release/mame_mame"
2x:"Generating m65c02 disassembler source file..."


I couldn't figure out why the line counts didn't match sometimes I wanted to "diff" the runs to see how the were different.

For instance, the first run A has 3 lines of "Creating ../../../../linux_gcc/bin/x64/Release/mame_mame" where the second run B has only 2 line of "Creating ../../../../linux_gcc/bin/x64/Release/mame_mame".

#112689 - 02/19/18 12:29 PM Re: Compile stats [Re: Golden Child]  
Joined: Feb 2014
Posts: 127
Golden Child Offline
Senior Member
Golden Child  Offline
Senior Member

Joined: Feb 2014
Posts: 127
And more silly compiling fun (under Ubuntu 17.10)

I thought I'd add some speech so that it'd say "Compile started" and "Compile Completed". Ubuntu's got this spd-say command which makes it easy, just do an os.execute("spd-say 'Open the pod bay doors, hal'")

And I wanted to see some graphics so why not try to send some values to gnuplot using lua, like this perl script from https://www.thanassis.space/gnuplotStreaming.html

and you get something like this:

[Linked Image]

and if you make a reference timefile you can just cat it to this script (which is fun to watch because it's fast):

cat luatimemake.txt | lua5.3 luaplot_test.lua

If you haven't got gnuplot installed, just do "sudo apt install gnuplot-qt".

Code

numbarks = 1

brun_table = {}
brun_linenumkey_table = {}


function saystring(str) str = "\""..str.."\"" print(str) os.execute("spd-say -w "..str)  end


function dogbark() for i = 1,numbarks do os.execute("play -q /usr/share/sounds/gnome/default/alerts/bark.ogg") end end
-- for dogbark to work you have to "sudo apt install sox"
dogbark()
saystring("Compile started")

f = io.open("luatimemake.txt","rb")
fileout = io.open("luacompareoutput2.txt","w")
linenum = 0

function formattime(a) local min,minfrac = math.modf(a/60) return min..":"..string.format("%02.0f",minfrac*60) end

function progressbar(size,fraction)
local numbars = math.floor((size-2)*(fraction))
local fracpart = ((size-2)*fraction)-numbars
--local onechar = string.sub("01234567890",math.floor(fracpart*10)+1,math.floor(fracpart*10)+1)
--local onechar = string.sub(".,;:-=+\\|/*#",math.floor(fracpart*10)+1,math.floor(fracpart*10)+1)
  local onechar = string.sub(".abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",math.floor(fracpart*53)+1,math.floor(fracpart*53)+1)
local numremain = (size-2)-numbars
if numbars >= size - 2 then onechar = "" end
  return "["..string.rep("#",numbars)..onechar..string.rep(".",numremain-string.len(onechar)).."]".." "..string.format("%6.2f%%",100*fraction)
end

-- for i =0,100,0.5 do print (i,progressbar(80,i/100),progressbar(10,i/100)) end

function pprint(a) fileout:write(a .. "\n") print(a) end
function printt(t) for a,b in pairs(t) do print (a,b) end end

function dumpstring(a) for k = 1,string.len(a) do print (k,string.format("%3d",string.byte(a,k)).." "..string.sub(a,k,k)) end end

function add_to_table_and_check_duplicate(linestr,linetime,run_table,linenum,linenum_key_table)
local linestr2
if linestr ~= nil then
-- print(linestr) 
  if run_table[linestr]~= nil then 
    run_table[linestr]["count"] = run_table[linestr]["count"]+1  
    linestr2 = linestr .. "<DUPLICATE LINE NUM=" .. run_table[linestr]["count"]..">" print(linestr) 
  end
  if run_table[linestr]==nil then run_table[linestr] ={linenum=linenum,linetime=tonumber(linetime),count=1 }
                     else run_table[linestr2]={linenum=linenum,linetime=tonumber(linetime),count=1 }
                        pprint ("Original at "..run_table[linestr]["linenum"].." Duplicate at "..linenum..":\""..linestr2.."\" origtime = "..run_table[linestr]["linetime"].." newtime = "..linetime) 
  end 
end 
  if linestr2 ~= nil then 
     linenum_key_table[linenum]=linestr2
     run_table[linestr2]["linestr"]=linestr2
     return linestr2 
  else 
     linenum_key_table[linenum]=linestr
     run_table[linestr]["linestr"]=linestr
     return linestr 
  end
end



arun_linenumkey_table = {}
arun_table = {} f:seek("set") g = f:read() 
while g ~= nil do 
linetime,linestr = g:match("(.-)\t(.*)") 

maxval = tonumber(linetime) 
linenum = linenum + 1 

add_to_table_and_check_duplicate(linestr,linetime,arun_table,linenum,arun_linenumkey_table)

g = f:read() end

function setup_plot() 
pip = io.popen("gnuplot ","w")
end

function setup_plot2() 
pip2 = io.popen("gnuplot ","w")
end

function iif(a,b,c) if a then return b else return c end end

function make_plot2()

pip2:write("set xlabel 'time (in seconds)'\n")
pip2:write("set ylabel 'compile items'\n")
pip2:write("set style line 2 linewidth 2\n")

pip2:write("y2(x)=m2*x+b2\n")
pip2:write("set fit quiet\n")

pip2:write("fit y2(x) '-' via m2,b2\n")

for i =1,#brun_linenumkey_table,iif(#brun_linenumkey_table<skipinterval,1,skipinterval*skipfitmultiplier) do 
pip2:write(brun_table[brun_linenumkey_table[i]]["linetime"].." "..brun_table[brun_linenumkey_table[i]]["linenum"].."\n")
end
pip2:write("e\n")
pip2:flush()

pip2:write("plot '-' title 'brun' with lines,y2(x)\n")

for i =#brun_linenumkey_table-50,#brun_linenumkey_table do 
if i>=1 then
pip2:write(brun_table[brun_linenumkey_table[i]]["linetime"].." "..brun_table[brun_linenumkey_table[i]]["linenum"].."\n")
end
end
pip2:write("e\n")
pip2:flush()

end

skipinterval = 10 -- lets skip to plot less datapoints, make it faster
skipmultiplier = 2
skipfitmultiplier = 5
function make_plot()

pip:write("set xlabel 'time (in seconds)'\n")
pip:write("set ylabel 'compile items'\n")

pip:write("y(x)=m*x+b\n")
pip:write("set fit quiet\n")
pip:write("fit y(x) '-' via m,b\n")

for i =1,#arun_linenumkey_table,skipinterval*skipfitmultiplier do 
pip:write(arun_table[arun_linenumkey_table[i]]["linetime"].." "..arun_table[arun_linenumkey_table[i]]["linenum"].."\n")
end
pip:write("e\n")
pip:flush()


pip:write("y2(x)=m2*x+b2\n")
pip:write("fit y2(x) '-' via m2,b2\n")


for i =1,#brun_linenumkey_table,skipinterval*skipfitmultiplier do 
pip:write(brun_table[brun_linenumkey_table[i]]["linetime"].." "..brun_table[brun_linenumkey_table[i]]["linenum"].."\n")
end
pip:write("e\n")
pip:flush()


pip:write("set style line 2 linewidth 2\n")
pip:write("set style line 3 linewidth 6\n")
pip:write("set yrange [*:10000]\n")
--pip:write("plot y(x), '-' with lines, '-' with points\n")
pip:write("plot y(x), '-' title 'arun' with lines, '-' title 'brun' with lines ls 3, y2(x)\n")


for i =1,#arun_linenumkey_table,skipinterval do 
pip:write(arun_table[arun_linenumkey_table[i]]["linetime"].." "..arun_table[arun_linenumkey_table[i]]["linenum"].."\n")
end
pip:write("e\n")
pip:flush()

for i =1,#brun_linenumkey_table,skipinterval do 
--print (i,brun_linenumkey_table[i],brun_table[brun_linenumkey_table[i]]["linetime"],brun_table[brun_linenumkey_table[i]]["linenum"])
pip:write(brun_table[brun_linenumkey_table[i]]["linetime"].." "..brun_table[brun_linenumkey_table[i]]["linenum"].."\n")
end
pip:write("e\n")
pip:flush()

end -- makeplot

setup_plot()
make_plot()

setup_plot2()

alinecount = 0
for a,b in pairs(arun_table) do alinecount = alinecount + 1 end
print("TOTAL ITEMS:" .. alinecount)

blinecount = 0

brun_table = {}
brun_linenumkey_table = {}

starttime = os.time()


while true do

if (blinecount % (skipinterval*skipmultiplier)) == 0 then make_plot() end

if (blinecount % 2) == 0 then make_plot2() end

newline = io.read()
blinecount = blinecount + 1



if newline == nil then break end

if string.match(newline,"(Linking mame64)") then saystring(string.match(newline,"(Linking mame64)")) end

if newline:match("\t") ~= nil then
  print("matching TAB character")
  newlinetime,newline = newline:match("(.-)\t(.*)") 
  if newlinetime=="" then print("newlinetime is empty string") newlinetime = os.time() - starttime print(newlinetime) end
  if newlinetime==nil then print("newlinetime is nil") newlinetime = os.time() - starttime print(newlinetime) end
else
  newlinetime = os.time() - starttime
end

newline = add_to_table_and_check_duplicate(newline,newlinetime,brun_table,blinecount,brun_linenumkey_table)

if arun_table[newline] ~= nil then oldlinetime = arun_table[newline]["linetime"] oldlinenum = arun_table[newline]["linenum"] else oldlinetime = nil end

pprint (newline)

if oldlinetime == nil then pprint("*** line not found *** NEW >>> "..newline) print(arun_table[newline]) else pprint("REF TIME A = " .. formattime(oldlinetime).." "..string.format("%4d",oldlinetime) .. " TIME B = " .. formattime(newlinetime).." ".. string.format("%4d",newlinetime) .. " SPEED = " .. string.format("%2.1f",(oldlinetime / newlinetime)*100) .."%".. " BCOUNT = " .. string.format("%4d",blinecount) .."/"..string.format("%4d",alinecount).." ".."ALINE = " .. string.format("%4d",oldlinenum) .."/"..string.format("%4d",alinecount).." ".. progressbar(52,oldlinenum/alinecount)) 
   brun_table[newline]["match"]=1
   arun_table[newline]["match"]=1
end
end

print("NOMATCH IN A")
for c,d in pairs(arun_table) do if arun_table[c]["match"]==nil then print ("NOMATCH A:"..c) end end
print("NOMATCH IN B")
for c,d in pairs(brun_table) do if brun_table[c]["match"]==nil then print ("NOMATCH B:"..c) end end

print("DUPLICATES IN A")
for c,d in pairs(arun_table) do if arun_table[c]["count"]>1 then print (arun_table[c]["count"].."x:".."line "..arun_table[c]["linenum"]..":".."\""..c.."\"") end end

print("DUPLICATES IN A IN ORDER")
for i =1,#arun_linenumkey_table do if arun_table[arun_linenumkey_table[i]]["count"]>1 or string.find(arun_table[arun_linenumkey_table[i]]["linestr"],"<DUPLICATE LINE NUM=") ~= nil then print("A DUP:"..arun_table[arun_linenumkey_table[i]]["count"].."x:".."line "..arun_table[arun_linenumkey_table[i]]["linenum"]..":".."\""..arun_linenumkey_table[i].."\"") end end

print("DUPLICATES IN B")
for c,d in pairs(brun_table) do if brun_table[c]["count"]>1 then print (brun_table[c]["count"].."x:".."line "..arun_table[c]["linenum"]..":".."\""..c.."\"") end end

print("DUPLICATES IN B IN ORDER")
for i =1,#brun_linenumkey_table do if brun_table[brun_linenumkey_table[i]]["count"]>1 or string.find(brun_table[brun_linenumkey_table[i]]["linestr"],"<DUPLICATE LINE NUM=") ~= nil then print("B DUP:"..brun_table[arun_linenumkey_table[i]]["count"].."x:".."line "..brun_table[brun_linenumkey_table[i]]["linenum"]..":".."\""..brun_linenumkey_table[i].."\"") end end

print("NUM ENTRIES IN A: "..#arun_linenumkey_table)
print("NUM ENTRIES IN B: "..#brun_linenumkey_table)

compilemins,compileminsfrac = math.modf((os.time()-starttime)/60)
compilesecs = compileminsfrac * 60
saystring("Compile completed in "..string.format("%.0f",compilemins).." minutes and "..string.format("%.0f",compilesecs).." seconds.")

dogbark()

os.execute("sleep 10")

pip:close()
pip2:close()


Page 2 of 2 1 2

Moderated by  R. Belmont 

Who's Online Now
6 registered members (elcondor, Vas Crabb, Dorando, R. Belmont, AJR, Edstrom), 17 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Shout Box
Forum Statistics
Forums9
Topics8,496
Posts110,806
Members4,781
Most Online225
May 26th, 2014
Powered by UBB.threads™ PHP Forum Software 7.6.0
Page Time: 0.050s Queries: 16 (0.028s) Memory: 4.9825 MB (Peak: 5.1849 MB) Zlib enabled. Server Time: 2018-02-22 16:10:32 UTC