Skip to content

Commit 64d2c9a

Browse files
committed
Fix line numbers in Lua code example - 2
1 parent 80bd48f commit 64d2c9a

File tree

2 files changed

+16
-14
lines changed

2 files changed

+16
-14
lines changed

doc/tooling/luajit_memprof.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Below is a chunk of Lua code named ``test.lua`` to illustrate this.
4343
.. _profiler_usage_example01:
4444

4545
.. code-block:: lua
46+
:linenos:
4647
4748
-- Prevent allocations on traces.
4849
jit.off()

doc/tooling/luajit_sysprof.rst

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,26 +59,27 @@ Below is a chunk of Lua code named ``test.lua`` to illustrate this.
5959
.. _profiler_usage_example01:
6060

6161
.. code-block:: lua
62-
63-
local function payload()
64-
local function fib(n)
65-
if n <= 1 then
66-
return n
62+
:linenos:
63+
64+
local function payload()
65+
local function fib(n)
66+
if n <= 1 then
67+
return n
68+
end
69+
return fib(n - 1) + fib(n - 2)
6770
end
68-
return fib(n - 1) + fib(n - 2)
71+
return fib(32)
6972
end
70-
return fib(32)
71-
end
7273
73-
payload()
74+
payload()
7475
75-
local res, err = misc.sysprof.start({mode = 'C', interval = 1, path = 'sysprof.bin'})
76-
assert(res, err)
76+
local res, err = misc.sysprof.start({mode = 'C', interval = 1, path = 'sysprof.bin'})
77+
assert(res, err)
7778
78-
payload()
79+
payload()
7980
80-
res, err = misc.sysprof.stop()
81-
assert(res, err)
81+
res, err = misc.sysprof.stop()
82+
assert(res, err)
8283
8384
The Lua code for starting the profiler -- as in line 1 in the
8485
``test.lua`` example above -- is:

0 commit comments

Comments
 (0)