Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
e64eb3ce
Commit
e64eb3ce
authored
Nov 30, 2020
by
jamesge
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
partial fix for profiling under MacOS, symbols are not shown yet(even with llvm-symbolizer)
parent
61667b29
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
hotspots_service.cpp
src/brpc/builtin/hotspots_service.cpp
+5
-2
brpc_builtin_service_unittest.cpp
test/brpc_builtin_service_unittest.cpp
+3
-3
No files found.
src/brpc/builtin/hotspots_service.cpp
View file @
e64eb3ce
...
@@ -376,6 +376,7 @@ static void NotifyWaiters(ProfilingType type, const Controller* cur_cntl,
...
@@ -376,6 +376,7 @@ static void NotifyWaiters(ProfilingType type, const Controller* cur_cntl,
}
}
#if defined(OS_MACOSX)
#if defined(OS_MACOSX)
static
const
char
*
s_pprof_binary_path
=
nullptr
;
static
bool
check_GOOGLE_PPROF_BINARY_PATH
()
{
static
bool
check_GOOGLE_PPROF_BINARY_PATH
()
{
char
*
str
=
getenv
(
"GOOGLE_PPROF_BINARY_PATH"
);
char
*
str
=
getenv
(
"GOOGLE_PPROF_BINARY_PATH"
);
if
(
str
==
NULL
)
{
if
(
str
==
NULL
)
{
...
@@ -385,6 +386,7 @@ static bool check_GOOGLE_PPROF_BINARY_PATH() {
...
@@ -385,6 +386,7 @@ static bool check_GOOGLE_PPROF_BINARY_PATH() {
if
(
fd
<
0
)
{
if
(
fd
<
0
)
{
return
false
;
return
false
;
}
}
s_pprof_binary_path
=
strdup
(
str
);
return
true
;
return
true
;
}
}
...
@@ -491,13 +493,13 @@ static void DisplayResult(Controller* cntl,
...
@@ -491,13 +493,13 @@ static void DisplayResult(Controller* cntl,
}
}
cmd_builder
<<
" 2>&1 "
;
cmd_builder
<<
" 2>&1 "
;
#elif defined(OS_MACOSX)
#elif defined(OS_MACOSX)
cmd_builder
<<
getenv
(
"GOOGLE_PPROF_BINARY_PATH"
)
<<
" "
cmd_builder
<<
s_pprof_binary_path
<<
" "
<<
DisplayTypeToPProfArgument
(
display_type
)
<<
DisplayTypeToPProfArgument
(
display_type
)
<<
(
show_ccount
?
" -contentions "
:
""
);
<<
(
show_ccount
?
" -contentions "
:
""
);
if
(
base_name
)
{
if
(
base_name
)
{
cmd_builder
<<
"-base "
<<
*
base_name
<<
' '
;
cmd_builder
<<
"-base "
<<
*
base_name
<<
' '
;
}
}
cmd_builder
<<
prof_name
<<
" 2>&1 "
;
cmd_builder
<<
GetProgramName
()
<<
" "
<<
prof_name
<<
" 2>&1 "
;
#endif
#endif
const
std
::
string
cmd
=
cmd_builder
.
str
();
const
std
::
string
cmd
=
cmd_builder
.
str
();
...
@@ -517,6 +519,7 @@ static void DisplayResult(Controller* cntl,
...
@@ -517,6 +519,7 @@ static void DisplayResult(Controller* cntl,
errno
=
0
;
// read_command_output may not set errno, clear it to make sure if
errno
=
0
;
// read_command_output may not set errno, clear it to make sure if
// we see non-zero errno, it's real error.
// we see non-zero errno, it's real error.
butil
::
IOBufBuilder
pprof_output
;
butil
::
IOBufBuilder
pprof_output
;
RPC_VLOG
<<
"Running cmd="
<<
cmd
;
const
int
rc
=
butil
::
read_command_output
(
pprof_output
,
cmd
.
c_str
());
const
int
rc
=
butil
::
read_command_output
(
pprof_output
,
cmd
.
c_str
());
if
(
rc
!=
0
)
{
if
(
rc
!=
0
)
{
butil
::
FilePath
pprof_path
(
pprof_tool
);
butil
::
FilePath
pprof_path
(
pprof_tool
);
...
...
test/brpc_builtin_service_unittest.cpp
View file @
e64eb3ce
...
@@ -663,15 +663,15 @@ TEST_F(BuiltinServiceTest, pprof) {
...
@@ -663,15 +663,15 @@ TEST_F(BuiltinServiceTest, pprof) {
ClosureChecker
done
;
ClosureChecker
done
;
brpc
::
Controller
cntl
;
brpc
::
Controller
cntl
;
service
.
heap
(
&
cntl
,
NULL
,
NULL
,
&
done
);
service
.
heap
(
&
cntl
,
NULL
,
NULL
,
&
done
);
const
int
rc
=
getenv
(
"TCMALLOC_SAMPLE_PARAMETER"
)
?
0
:
brpc
::
ENOMETHOD
;
const
int
rc
=
getenv
(
"TCMALLOC_SAMPLE_PARAMETER"
)
!=
nullptr
?
0
:
brpc
::
ENOMETHOD
;
EXPECT_EQ
(
rc
,
cntl
.
ErrorCode
());
EXPECT_EQ
(
rc
,
cntl
.
ErrorCode
())
<<
cntl
.
ErrorText
()
;
}
}
{
{
ClosureChecker
done
;
ClosureChecker
done
;
brpc
::
Controller
cntl
;
brpc
::
Controller
cntl
;
service
.
growth
(
&
cntl
,
NULL
,
NULL
,
&
done
);
service
.
growth
(
&
cntl
,
NULL
,
NULL
,
&
done
);
// linked tcmalloc in UT
// linked tcmalloc in UT
EXPECT_EQ
(
0
,
cntl
.
ErrorCode
());
EXPECT_EQ
(
0
,
cntl
.
ErrorCode
())
<<
cntl
.
ErrorText
()
;
}
}
{
{
ClosureChecker
done
;
ClosureChecker
done
;
...
...
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