Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bpftrace
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
bpftrace
Commits
6d6dec86
Commit
6d6dec86
authored
Jun 24, 2017
by
Alastair Robertson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Print out values and keys as signed integers
parent
17117141
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
6 deletions
+6
-6
src/bpftrace.cpp
src/bpftrace.cpp
+2
-2
src/bpftrace.h
src/bpftrace.h
+1
-1
src/map.cpp
src/map.cpp
+1
-1
src/mapkey.cpp
src/mapkey.cpp
+2
-2
No files found.
src/bpftrace.cpp
View file @
6d6dec86
...
...
@@ -90,7 +90,7 @@ int BPFtrace::print_map(Map &map) const
{
std
::
cout
<<
map
.
name_
<<
map
.
key_
.
argument_value_list
(
*
this
,
key
)
<<
": "
;
u
int64_t
value
;
int64_t
value
;
int
err
=
bpf_lookup_elem
(
map
.
mapfd_
,
key
.
data
(),
&
value
);
if
(
err
)
{
...
...
@@ -264,7 +264,7 @@ std::vector<uint8_t> BPFtrace::find_empty_key(Map &map, size_t size) const
throw
std
::
runtime_error
(
"Could not find empty key"
);
}
std
::
string
BPFtrace
::
get_stack
(
uint
64
_t
stackid
,
int
indent
)
const
std
::
string
BPFtrace
::
get_stack
(
uint
32
_t
stackid
,
int
indent
)
const
{
auto
stack_trace
=
std
::
vector
<
uint64_t
>
(
MAX_STACK_SIZE
);
int
err
=
bpf_lookup_elem
(
stackid_map_
->
mapfd_
,
&
stackid
,
stack_trace
.
data
());
...
...
src/bpftrace.h
View file @
6d6dec86
...
...
@@ -19,7 +19,7 @@ public:
int
start
();
void
stop
();
int
print_maps
()
const
;
std
::
string
get_stack
(
uint
64
_t
stackid
,
int
indent
=
0
)
const
;
std
::
string
get_stack
(
uint
32
_t
stackid
,
int
indent
=
0
)
const
;
std
::
map
<
std
::
string
,
std
::
unique_ptr
<
Map
>>
maps_
;
std
::
map
<
std
::
string
,
std
::
tuple
<
uint8_t
*
,
uintptr_t
>>
sections_
;
...
...
src/map.cpp
View file @
6d6dec86
...
...
@@ -29,7 +29,7 @@ Map::Map(std::string name) : name_(name)
{
// Only used for creating maps for storing stack IDs
int
key_size
=
4
;
int
value_size
=
8
*
MAX_STACK_SIZE
;
int
value_size
=
sizeof
(
uintptr_t
)
*
MAX_STACK_SIZE
;
int
max_entries
=
128
;
int
flags
=
0
;
mapfd_
=
bpf_create_map
(
BPF_MAP_TYPE_STACK_TRACE
,
key_size
,
value_size
,
max_entries
,
flags
);
...
...
src/mapkey.cpp
View file @
6d6dec86
...
...
@@ -61,9 +61,9 @@ std::string MapKey::argument_value(const BPFtrace &bpftrace,
switch
(
arg
.
size
)
{
case
8
:
return
std
::
to_string
(
*
(
u
int64_t
*
)
data
);
return
std
::
to_string
(
*
(
int64_t
*
)
data
);
case
4
:
return
std
::
to_string
(
*
(
u
int32_t
*
)
data
);
return
std
::
to_string
(
*
(
int32_t
*
)
data
);
}
case
Type
:
:
stack
:
return
bpftrace
.
get_stack
(
*
(
uint32_t
*
)
data
);
...
...
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