Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os = require("os")
- term = require("term")
- keyboard = require("keyboard")
- com = require("component")
- term = require("term")
- fs = require("filesystem")
- w,h = com.gpu.getResolution()
- crop = 0.4
- timeConstant = 0.1
- ww = w*crop
- hh = h*crop
- com.gpu.setResolution(ww, hh)
- joke = 0
- tSlot = 1
- function time()
- local f = io.open("/tmp/timeFile","w")
- f:write("test")
- f:close()
- return(fs.lastModified("/tmp/timeFile"))
- end
- TPS = {}
- avgTPS = 0
- for tSlot=1,10 do
- TPS[tSlot]=0
- end
- while joke < joke + 1 do
- realTimeOld = time()
- os.sleep(timeConstant)
- realTimeNew = time()
- realTimeDiff = realTimeNew-realTimeOld
- TPS[tSlot] = 20000*timeConstant/realTimeDiff
- avgTPS = (TPS[1]+TPS[2]+TPS[3]+TPS[4]+TPS[5]+TPS[6]+TPS[7]+TPS[8]+TPS[9]+TPS[10])/10
- if joke < ww then
- term.clear()
- com.gpu.setBackground(0x000080)
- com.gpu.setForeground(0xFFFFFF)
- print("roga122 tps checker\n")
- com.gpu.setBackground(0x000000)
- com.gpu.setForeground(0x00ff00)
- com.gpu.fill(1, 7, joke, 1, '█')
- com.gpu.fill(1, 8, joke, 1, '█')
- com.gpu.fill(1, 9, joke, 1, '█')
- com.gpu.setForeground(0xFFFFFF)
- print("TPS сейчас:", string.format("%.2f",TPS[tSlot]))
- print("TPS средний:", string.format("%.2f",avgTPS))
- else
- term.clear()
- com.gpu.setBackground(0x000080)
- com.gpu.setForeground(0xFFFFFF)
- print("roga122 tps checker\n")
- com.gpu.setBackground(0x000000)
- com.gpu.setForeground(0xFFFFFF)
- print("TPS сейчас:", string.format("%.2f",TPS[tSlot]))
- print("TPS средний:", string.format("%.2f",avgTPS))
- joke = 0
- end;
- joke = joke + 1
- if tSlot == 10 then
- tSlot = 0
- end;
- tSlot = tSlot + 1
- print("\n\n\n\n\n\nДля выхода удерживайте\nCtrl + W\n")
- if keyboard.isKeyDown(keyboard.keys.w) and keyboard.isControlDown() then
- term.clear()
- com.gpu.setResolution(w, h)
- print("Выход...")
- os.exit()
- end;
- end;
Add Comment
Please, Sign In to add comment