[go: up one dir, main page]

File: trace-memcpy.lua

package info (click to toggle)
uftrace 0.13-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 5,212 kB
  • sloc: ansic: 53,313; python: 9,846; makefile: 838; asm: 703; cpp: 602; sh: 560; javascript: 191
file content (31 lines) | stat: -rw-r--r-- 588 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
--
-- trace-memcpy.lua
--
-- uftrace-option: --nest-libcall -T memcpy@filter,arg3
--
--   void *memcpy(void *dest, const void *src, size_t n);
--

-- Only "memcpy" calls this script and other functions never.
UFTRACE_FUNCS = { 'memcpy' }

count = 0
total_bytes = 0

function uftrace_begin(ctx)
end

function uftrace_entry(ctx)
    count = count + 1
    if ctx['args'] ~= nil then
        total_bytes = total_bytes + ctx['args'][1]
    end
end

function uftrace_exit(ctx)
end

function uftrace_end()
    print(count .. ' times memcpy called')
    print(total_bytes .. ' bytes copied')
end