FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
UnityAndroidIl2cppPatchDemo-libboostrap/profiler.cpp at master · marklalon/UnityAndroidIl2cppPatchDemo-libboostrap · GitHub
marklalon
/
UnityAndroidIl2cppPatchDemo-libboostrap
Public
forked from
noodle1983/UnityAndroidIl2cppPatchDemo-libboostrap
Notifications
You must be signed in to change notification settings
Fork
3
Star
1
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
UnityAndroidIl2cppPatchDemo-libboostrap
/
profiler.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
50 lines (44 loc) · 1.23 KB
Breadcrumbs
UnityAndroidIl2cppPatchDemo-libboostrap
/
profiler.cpp
Copy path
File metadata and controls
50 lines (44 loc) · 1.23 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
//
Created by lizhen on 2020/11/14.
//
#
include
<
unistd.h
>
#
include
"
profiler.h
"
#
include
"
log.h
"
#
include
"
zip/shadow_zip.h
"
PROFILER_MAP
g_profiler_data;
PthreadRwMutex g_profiler_mutex;
int
g_total_file_handlers;
void
dump_profiler
()
{
PthreadReadGuard
guard
(g_profiler_mutex);
MY_INFO
(
"
==================Profiler Dump================
"
);
for
(
PROFILER_MAP
::iterator it=g_profiler_data.
begin
(); it != g_profiler_data.
end
(); ++it)
{
const
char
* name = it->
first
;
ProfilerData* data = it->
second
;
int
totalMilliSec = (
int
)(data->
totalNanoSec
/
1000000
);
MY_INFO
(
"
Profiler [%s] count:[%d], total_time:[%d ms]
"
, name, data->
count
, totalMilliSec);
}
MY_INFO
(
"
Profiler total files open:[%d], total ShadowZip cache count:[%d]
"
, g_total_file_handlers, (
int
)g_shadow_zip_cache.
size
());
}
void
*
profiler_thread_proc
(
void
*arg)
{
while
(
true
)
{
sleep
(
3
);
dump_profiler
();
}
}
void
create_monitor_thread
()
{
pthread_t
threadid;
pthread_create
(&threadid,
NULL
, &profiler_thread_proc,
NULL
);
MY_INFO
(
"
create_monitor_thread
"
);
}
void
msleep
(
long
msec)
{
struct
timespec
ts;
ts.
tv_sec
= msec /
1000
;
ts.
tv_nsec
= (msec %
1000
) *
1000000
;
nanosleep
(&ts,
NULL
);
}
Back
|
FazBrowse Home
|
New Git URL