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
488c119e
Commit
488c119e
authored
Sep 13, 2017
by
Teng Qin
Committed by
Brenden Blanco
Sep 13, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deduplicate USDT probe locations
parent
486d348f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
src/cc/usdt.h
src/cc/usdt.h
+1
-0
src/cc/usdt/usdt.cc
src/cc/usdt/usdt.cc
+17
-0
No files found.
src/cc/usdt.h
View file @
488c119e
...
...
@@ -181,6 +181,7 @@ public:
return
largest_arg_type
(
arg_index
);
}
void
finalize_locations
();
bool
need_enable
()
const
{
return
semaphore_
!=
0x0
;
}
bool
enable
(
const
std
::
string
&
fn_name
);
bool
disable
();
...
...
src/cc/usdt/usdt.cc
View file @
488c119e
...
...
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <algorithm>
#include <cstring>
#include <sstream>
#include <unordered_set>
...
...
@@ -197,6 +198,18 @@ void Probe::add_location(uint64_t addr, const char *fmt) {
locations_
.
emplace_back
(
addr
,
fmt
);
}
void
Probe
::
finalize_locations
()
{
std
::
sort
(
locations_
.
begin
(),
locations_
.
end
(),
[](
const
Location
&
a
,
const
Location
&
b
)
{
return
a
.
address_
<
b
.
address_
;
});
auto
last
=
std
::
unique
(
locations_
.
begin
(),
locations_
.
end
(),
[](
const
Location
&
a
,
const
Location
&
b
)
{
return
a
.
address_
==
b
.
address_
;
});
locations_
.
erase
(
last
,
locations_
.
end
());
}
void
Context
::
_each_probe
(
const
char
*
binpath
,
const
struct
bcc_elf_usdt
*
probe
,
void
*
p
)
{
Context
*
ctx
=
static_cast
<
Context
*>
(
p
);
...
...
@@ -294,6 +307,8 @@ Context::Context(const std::string &bin_path)
loaded_
=
true
;
}
}
for
(
const
auto
&
probe
:
probes_
)
probe
->
finalize_locations
();
}
Context
::
Context
(
int
pid
)
:
pid_
(
pid
),
pid_stat_
(
pid
),
...
...
@@ -313,6 +328,8 @@ Context::Context(int pid) : pid_(pid), pid_stat_(pid),
loaded_
=
true
;
}
for
(
const
auto
&
probe
:
probes_
)
probe
->
finalize_locations
();
}
Context
::~
Context
()
{
...
...
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