FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
daScript/src/simulate/runtime_profile.cpp at master · nolankramer/daScript · GitHub
nolankramer
/
daScript
Public
forked from
GaijinEntertainment/daScript
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
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
daScript
/
src
/
simulate
/
runtime_profile.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
29 lines (24 loc) · 917 Bytes
Breadcrumbs
daScript
/
src
/
simulate
/
runtime_profile.cpp
Copy path
File metadata and controls
29 lines (24 loc) · 917 Bytes
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
#
include
"
daScript/misc/platform.h
"
#
include
"
daScript/simulate/runtime_profile.h
"
#
include
"
misc/include_fmt.h
"
extern
"
C
"
int64_t
ref_time_ticks
();
extern
"
C
"
int
get_time_usec
(
int64_t
reft);
namespace
das
{
float
builtin_profile
(
int32_t
count,
const
char
* category,
const
Block & block, Context * context, LineInfoArg * at ) {
count =
das::max
(count,
1
);
int
minT =
INT32_MAX
;
for
(
int32_t
i =
0
; i != count; ++i ) {
int64_t
reft =
ref_time_ticks
();
context->
invoke
(block,
nullptr
,
nullptr
, at);
minT =
das::min
(
get_time_usec
(reft), minT);
}
double
tSec = minT/
1000000
.;
if
( category ) {
TextWriter ss;
ss <<
"
\"
"
<< category <<
"
\"
,
"
<<
fmt::format
(
"
{:.9f}
"
,tSec) <<
"
,
"
<< count <<
"
\n
"
;
context->
to_out
(at, ss.
str
().
c_str
());
}
return
(
float
) tSec;
}
}
Back
|
FazBrowse Home
|
New Git URL