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
19d92a2a
Commit
19d92a2a
authored
Apr 16, 2017
by
Alastair Robertson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Store map name in map class
parent
aa05dca0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
5 deletions
+6
-5
src/codegen_llvm.cpp
src/codegen_llvm.cpp
+2
-2
src/map.cpp
src/map.cpp
+2
-2
src/map.h
src/map.h
+2
-1
No files found.
src/codegen_llvm.cpp
View file @
19d92a2a
...
...
@@ -28,7 +28,7 @@ void CodegenLLVM::visit(Map &map)
{
int
mapfd
;
if
(
bpftrace_
.
maps_
.
find
(
map
.
ident
)
==
bpftrace_
.
maps_
.
end
())
{
bpftrace_
.
maps_
[
map
.
ident
]
=
std
::
make_unique
<
ebpf
::
bpftrace
::
Map
>
();
bpftrace_
.
maps_
[
map
.
ident
]
=
std
::
make_unique
<
ebpf
::
bpftrace
::
Map
>
(
map
.
ident
);
}
mapfd
=
bpftrace_
.
maps_
[
map
.
ident
]
->
mapfd_
;
...
...
@@ -104,7 +104,7 @@ void CodegenLLVM::visit(AssignMapStatement &assignment)
Map
&
map
=
*
assignment
.
map
;
int
mapfd
;
if
(
bpftrace_
.
maps_
.
find
(
map
.
ident
)
==
bpftrace_
.
maps_
.
end
())
{
bpftrace_
.
maps_
[
map
.
ident
]
=
std
::
make_unique
<
ebpf
::
bpftrace
::
Map
>
();
bpftrace_
.
maps_
[
map
.
ident
]
=
std
::
make_unique
<
ebpf
::
bpftrace
::
Map
>
(
map
.
ident
);
}
mapfd
=
bpftrace_
.
maps_
[
map
.
ident
]
->
mapfd_
;
...
...
src/map.cpp
View file @
19d92a2a
...
...
@@ -7,11 +7,11 @@
namespace
ebpf
{
namespace
bpftrace
{
Map
::
Map
()
{
Map
::
Map
(
std
::
string
&
name
)
:
name_
(
name
)
{
mapfd_
=
bpf_create_map
(
BPF_MAP_TYPE_HASH
,
8
,
8
,
128
,
0
);
if
(
mapfd_
<
0
)
{
std
::
cerr
<<
"Error creating map
"
<<
std
::
endl
;
;
std
::
cerr
<<
"Error creating map
: '"
<<
name_
<<
"'"
<<
std
::
endl
;
}
}
...
...
src/map.h
View file @
19d92a2a
...
...
@@ -8,10 +8,11 @@ namespace bpftrace {
class
Map
{
public:
Map
(
);
explicit
Map
(
std
::
string
&
);
~
Map
();
int
mapfd_
;
std
::
string
name_
;
};
}
// namespace bpftrace
...
...
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