Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bcc
Commits
7601b4b3
Commit
7601b4b3
authored
Apr 01, 2016
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcc: Allow the runner to parse some arguments
parent
8f412d28
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
3 deletions
+42
-3
src/lua/bcc/libbcc.lua
src/lua/bcc/libbcc.lua
+1
-1
src/lua/bcc/run.lua
src/lua/bcc/run.lua
+41
-2
No files found.
src/lua/bcc/libbcc.lua
View file @
7601b4b3
...
...
@@ -98,4 +98,4 @@ int perf_reader_fd(struct perf_reader *reader);
void perf_reader_set_fd(struct perf_reader *reader, int fd);
]]
return
ffi
.
load
(
rawget
(
_G
,
"LIBBCC_SO_PATH"
)
or
"bcc"
)
return
ffi
.
load
(
os.getenv
(
"LIBBCC_SO_PATH"
)
or
rawget
(
_G
,
"LIBBCC_SO_PATH"
)
or
"bcc"
)
src/lua/bcc/run.lua
View file @
7601b4b3
...
...
@@ -14,11 +14,51 @@ See the License for the specific language governing permissions and
limitations under the License.
]]
local
function
print_usage
()
io.stderr
:
write
(
"usage: bcc-probe [[--so-path=PATH|--version|--quiet] --] path_to_script.lua [...]\n"
)
os.exit
(
1
)
end
local
function
has_prefix
(
s
,
p
)
return
string.sub
(
s
,
1
,
string.len
(
p
))
==
p
end
local
function
strip_prefix
(
s
,
p
)
return
string.sub
(
s
,
string.len
(
p
)
+
1
)
end
return
function
()
local
logging
=
true
while
arg
[
1
]
and
has_prefix
(
arg
[
1
],
"-"
)
do
local
k
=
table.remove
(
arg
,
1
)
if
k
==
"--"
then
break
elseif
has_prefix
(
k
,
"--so-path="
)
then
rawset
(
_G
,
"LIBBCC_SO_PATH"
,
strip_prefix
(
k
,
"--so-path="
))
elseif
k
==
"-q"
or
k
==
"--quiet"
then
logging
=
false
elseif
k
==
"-v"
or
k
==
"--version"
then
local
jit
=
require
(
"jit"
)
print
(
string.format
(
"bcc-probe %s -- Running on %s (%s/%s)"
,
rawget
(
_G
,
"BCC_VERSION"
)
or
"HEAD"
,
jit
.
version
,
jit
.
os
,
jit
.
arch
))
return
true
else
print_usage
()
end
end
local
tracefile
=
table.remove
(
arg
,
1
)
if
not
tracefile
then
print_usage
()
end
local
BCC
=
require
(
"bcc.init"
)
local
BPF
=
BCC
.
BPF
BPF
.
script_root
(
arg
[
1
])
BPF
.
script_root
(
tracefile
)
log
.
enabled
=
logging
local
utils
=
{
argparse
=
require
(
"bcc.vendor.argparse"
),
...
...
@@ -26,7 +66,6 @@ return function()
sym
=
BCC
.
sym
}
local
tracefile
=
table.remove
(
arg
,
1
)
local
command
=
dofile
(
tracefile
)
local
res
,
err
=
pcall
(
command
,
BPF
,
utils
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment