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
e79676a7
Commit
e79676a7
authored
Sep 04, 2015
by
4ast
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #181 from iovisor/bblanco_dev
Reorganize cmake, some cleanups and test fixes.
parents
5d89d5fd
63640471
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
4 additions
and
110 deletions
+4
-110
CMakeLists.txt
CMakeLists.txt
+2
-2
cmake/GetGitRevisionDescription.cmake
cmake/GetGitRevisionDescription.cmake
+0
-0
cmake/GetGitRevisionDescription.cmake.in
cmake/GetGitRevisionDescription.cmake.in
+0
-0
cmake/bump_version.cmake
cmake/bump_version.cmake
+0
-0
cmake/version.cmake
cmake/version.cmake
+0
-2
src/cc/exception.h
src/cc/exception.h
+0
-104
tests/cc/test_trace2.py
tests/cc/test_trace2.py
+2
-2
No files found.
CMakeLists.txt
View file @
e79676a7
...
...
@@ -7,7 +7,8 @@ set(CMAKE_BUILD_TYPE Release)
enable_testing
()
include
(
scripts/GetGitRevisionDescription.cmake
)
include
(
cmake/GetGitRevisionDescription.cmake
)
include
(
cmake/version.cmake
)
get_property
(
LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS
)
if
(
LIB64
)
set
(
LIBSUFFIX 64
)
...
...
@@ -45,7 +46,6 @@ set(CMAKE_C_FLAGS "-Wall")
set
(
CMAKE_CXX_FLAGS
"-std=c++11 -Wall"
)
endif
()
add_subdirectory
(
scripts
)
add_subdirectory
(
examples
)
add_subdirectory
(
src
)
add_subdirectory
(
tests
)
scripts
/GetGitRevisionDescription.cmake
→
cmake
/GetGitRevisionDescription.cmake
View file @
e79676a7
File moved
scripts
/GetGitRevisionDescription.cmake.in
→
cmake
/GetGitRevisionDescription.cmake.in
View file @
e79676a7
File moved
scripts
/bump_version.cmake
→
cmake
/bump_version.cmake
View file @
e79676a7
File moved
scripts/CMakeLists.txt
→
cmake/version.cmake
View file @
e79676a7
...
...
@@ -19,7 +19,5 @@ endif()
# strip leading 'v', and make unique for the tag
message
(
STATUS
"Revision is
${
REVISION
}
"
)
set
(
REVISION
"
${
REVISION
}
"
PARENT_SCOPE
)
# rpm/deb packaging uses this, only works on whole tag numbers
string
(
SUBSTRING
"
${
GIT_TAG_LAST
}
"
1 -1 REVISION_LAST
)
set
(
REVISION_LAST
"
${
REVISION_LAST
}
"
PARENT_SCOPE
)
src/cc/exception.h
View file @
e79676a7
...
...
@@ -26,94 +26,6 @@
namespace
ebpf
{
class
Exception
:
public
std
::
exception
{
public:
virtual
~
Exception
()
throw
()
{}
};
class
StringException
:
public
Exception
{
public:
StringException
()
:
errstr_
(
"unknown"
)
{}
virtual
~
StringException
()
throw
()
{}
explicit
StringException
(
const
std
::
string
&
s
)
:
errstr_
(
s
)
{}
explicit
StringException
(
const
char
*
s
)
:
errstr_
(
s
)
{}
template
<
typename
...
Args
>
StringException
(
const
char
*
s
,
Args
...
args
)
{
char
x
[
1024
];
snprintf
(
x
,
sizeof
(
x
),
s
,
args
...);
errstr_
.
assign
(
x
);
}
virtual
const
char
*
what
()
const
throw
()
{
return
errstr_
.
c_str
();
}
protected:
std
::
string
errstr_
;
};
class
ErrnoException
:
public
StringException
{
public:
ErrnoException
()
:
StringException
(
strerror
(
errno
))
{}
explicit
ErrnoException
(
const
std
::
string
&
s
)
:
StringException
(
s
+
": "
+
strerror
(
errno
))
{}
explicit
ErrnoException
(
const
std
::
string
&
s
,
int
err
)
:
StringException
(
s
+
": "
+
strerror
(
err
))
{}
};
class
SystemException
:
public
StringException
{
public:
explicit
SystemException
(
int
status
)
{
if
(
status
==
-
1
)
{
errstr_
.
assign
(
"command not found"
);
}
else
{
errstr_
.
assign
(
"command exited with "
);
errstr_
+=
std
::
to_string
(
WEXITSTATUS
(
status
));
}
}
SystemException
(
int
status
,
const
std
::
string
&
s
)
{
if
(
status
==
-
1
)
{
errstr_
.
assign
(
"command not found"
);
}
else
{
errstr_
.
assign
(
"command exited with "
);
errstr_
+=
std
::
to_string
(
WEXITSTATUS
(
status
));
}
errstr_
+=
"; "
+
s
+
": "
+
strerror
(
errno
);
}
};
class
CompilerException
:
public
StringException
{
public:
explicit
CompilerException
(
const
std
::
string
&
s
)
:
StringException
(
s
)
{}
template
<
typename
...
Args
>
CompilerException
(
const
char
*
s
,
Args
...
args
)
:
StringException
(
s
,
args
...)
{}
};
class
WatermarkException
:
public
Exception
{
public:
WatermarkException
()
{}
virtual
const
char
*
what
()
const
throw
()
{
return
"Reached High Watermark"
;
}
};
class
TerminateException
:
public
Exception
{
public:
TerminateException
()
{}
virtual
const
char
*
what
()
const
throw
()
{
return
"Terminated"
;
}
};
class
StatusException
:
public
Exception
{
public:
explicit
StatusException
(
int
st
,
const
std
::
string
&
msg
)
:
st_
(
st
),
msg_
(
msg
)
{}
virtual
const
char
*
what
()
const
throw
()
{
return
msg_
.
c_str
();
}
int
status
()
const
{
return
st_
;
}
const
std
::
string
&
message
()
{
return
msg_
;
}
protected:
int
st_
;
std
::
string
msg_
;
};
template
<
typename
...
Args
>
std
::
tuple
<
int
,
std
::
string
>
mkstatus
(
int
ret
,
const
char
*
fmt
,
Args
...
args
)
{
char
buf
[
1024
];
...
...
@@ -129,22 +41,6 @@ static inline std::tuple<int, std::string> mkstatus(int ret) {
return
std
::
make_tuple
(
ret
,
std
::
string
());
}
#define TRYT(CMD) \
do { \
int __status = (CMD); \
if (__status != 0) { \
throw StatusException(__status); \
} \
} while (0)
#define TRY2T(CMD) \
do { \
std::tuple<int, std::string> __stp = (CMD); \
if (std::get<0>(__stp) != 0) { \
throw StatusException(std::get<0>(__stp)); \
} \
} while (0)
#define TRY(CMD) \
do { \
int __status = (CMD); \
...
...
tests/cc/test_trace2.py
View file @
e79676a7
...
...
@@ -26,13 +26,13 @@ class TestTracingEvent(TestCase):
def
setUp
(
self
):
b
=
BPF
(
text
=
text
,
debug
=
0
)
self
.
stats
=
b
.
get_table
(
"stats"
)
b
.
attach_kprobe
(
event
=
"
schedule+50
"
,
fn_name
=
"count_sched"
,
pid
=
0
,
cpu
=-
1
)
b
.
attach_kprobe
(
event
=
"
finish_task_switch
"
,
fn_name
=
"count_sched"
,
pid
=
0
,
cpu
=-
1
)
def
test_sched1
(
self
):
for
i
in
range
(
0
,
100
):
sleep
(
0.01
)
for
key
,
leaf
in
self
.
stats
.
items
():
print
(
"ptr %x:"
%
key
.
ptr
,
"stat1 %
x
"
%
leaf
.
stat1
)
print
(
"ptr %x:"
%
key
.
ptr
,
"stat1 %
d
"
%
leaf
.
stat1
)
if
__name__
==
"__main__"
:
main
()
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