Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
2588a25f
Commit
2588a25f
authored
May 22, 2015
by
Michael Arntzenius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enable disabling Timers
parent
a8bd855c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
src/core/util.cpp
src/core/util.cpp
+4
-0
src/core/util.h
src/core/util.h
+20
-0
No files found.
src/core/util.cpp
View file @
2588a25f
...
...
@@ -41,6 +41,8 @@ uint64_t getCPUTicks() {
return
rdtsc
();
}
#if !DISABLE_TIMERS
int
Timer
::
level
=
0
;
Timer
::
Timer
(
long
min_usec
)
:
min_usec
(
min_usec
),
ended
(
true
)
{
...
...
@@ -104,6 +106,8 @@ Timer::~Timer() {
}
}
#endif // !DISABLE_TIMERS
bool
startswith
(
const
std
::
string
&
s
,
const
std
::
string
&
pattern
)
{
if
(
pattern
.
size
()
>
s
.
size
())
return
false
;
...
...
src/core/util.h
View file @
2588a25f
...
...
@@ -26,6 +26,9 @@ namespace pyston {
uint64_t
getCPUTicks
();
#define DISABLE_TIMERS 0
#if !DISABLE_TIMERS
class
Timer
{
private:
static
int
level
;
...
...
@@ -58,6 +61,23 @@ public:
uint64_t
getStartTime
()
const
{
return
start_time
;
}
};
#else // DISABLE_TIMERS
class
Timer
{
public:
Timer
(
const
char
*
desc
=
NULL
,
long
min_usec
=
-
1
)
{}
Timer
(
long
min_usec
)
{}
void
setExitCallback
(
std
::
function
<
void
(
uint64_t
)
>
_exit_callback
)
{}
void
restart
(
const
char
*
newdesc
,
long
new_min_usec
)
{}
void
restart
(
const
char
*
newdesc
=
NULL
)
{}
long
end
()
{
return
0
;
}
long
split
(
const
char
*
newdesc
=
NULL
)
{
return
0
;
}
};
#endif // #else DISABLE_TIMERS
bool
startswith
(
const
std
::
string
&
s
,
const
std
::
string
&
pattern
);
bool
endswith
(
const
std
::
string
&
s
,
const
std
::
string
&
pattern
);
...
...
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