updated ReadMe

This commit is contained in:
Paul Liverman III 2017-07-26 20:48:46 -07:00
parent 4a970f3e33
commit d597cd7e67

View File

@ -1,16 +1,23 @@
# Piefiller # Piefiller
Graphical profiler for Love2D 9.2
# Usage
1) require the file:
```lua
piefiller = require("piefiller")
```
2) make a new instance of piefiller
```lua
Pie = piefiller:new()
```
3) attach the piefiller to the part of your application that you want to monitor, it can be whatever but I suggest calling it in love.update or love.draw as this is what piefiller is all about.
Graphical profiler for Love2D >= 0.9.2
Originally by devfirefly, heavily modified by Guard13007.
NOTE: This ReadMe does not currently represent the state of the library as I am
currently reworking it.
# Usage
1) Require the file:
```lua
local piefiller = require("piefiller")
```
2) Make a new instance of piefiller:
```lua
local Pie = piefiller:new()
```
3) Attach the piefiller to the part of your application that you want to monitor (love.update and love.draw typically are good places):
```lua ```lua
function love.update() function love.update()
Pie:attach() Pie:attach()
@ -18,37 +25,43 @@ Graphical profiler for Love2D 9.2
Pie:detach() Pie:detach()
end end
``` ```
4) draw the output in your draw function and give event hooks for your pie. 4) Draw the output and pass events to your piefiller:
```lua ```lua
function love.draw() function love.draw()
Pie:draw() Pie:draw()
end end
function love.keypressed(...) function love.keypressed(key)
Pie:keypressed(...) Pie:keypressed(key)
end end
function love.mousepressed(...) function love.mousepressed(...)
Pie:mousepressed(...) Pie:mousepressed(...)
end end
``` ```
5) When you get sufficient output press the "P" key to output to file. 5) With sufficient output, press the "E" key to output to file.
# Keys # Keys
r = resets the pie
up = decreases depth p = shows/hides the profiler
down = increases depth r = resets the pie
, = decreases step size up = decreases depth
. = increases step size down = increases depth
- = decreases step size
= = increases step size
s = shortens the names displayed s = shortens the names displayed
c = hides/shows hidden processes h = shows/hides hidden processes
e = saves to file called "Profile.txt" and opens directory for you
p = saves to file called "Profile" and opens directory for you
## To redefine these: ## To redefine these:
Modes available:
Commands available:
```lua ```lua
reset reset
increase_depth increase_depth
@ -58,11 +71,12 @@ decrease_step_size
shorten_names shorten_names
show_hidden show_hidden
save_to_file save_to_file
show_profiler
``` ```
To redefine only one of the keys:
To redefine only one of the keys:
```lua ```lua
piefiller:setKey(mode,key) piefiller:setKey(command, key)
``` ```
example: example:
@ -70,18 +84,19 @@ example:
```lua ```lua
piefiller:setKey("increase_depth","up") piefiller:setKey("increase_depth","up")
``` ```
To redefine all of the keys: To redefine all of the keys:
```lua ```lua
table = { table = {
"increase_depth" = "up" "increase_depth" = "up"
} }
piefiller:setKey(table) piefiller:setKey(table)
``` ```
# For your own interpretation # For your own interpretation
If you wish to interpret the data on your own use piefiller:unpack().
Output is a table as such: If you wish to interpret the data on your own use `piefiller:unpack()`.
Output is a table as such:
```lua ```lua
data = { data = {
@ -105,8 +120,13 @@ piefiller:setKey(table)
``` ```
# Additional notes # Additional notes
The best depth to search for is 2 and 3.
When used in large applications the output is difficult to read, however printing to file resolves this issue. The best depth to search in is usually 2 and sometimes 3.
When used in large applications the output may be too much to read, however you
most likely will only be wanting to optimize the most expensive items. (And you
can always output the data to review later.)
# Planned features # Planned features
Make sure that text does not overlay.
See my ToDo list, issue #1 on GitHub.