Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
faust
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
GitLab upgrade completed. Current version is 17.11.4.
Show more breadcrumbs
faust group
faust
Commits
a026a3ad
Commit
a026a3ad
authored
9 years ago
by
Nicolas Bellot
Committed by
hhakim
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
faust_Timer (compatible OS X (mach))
parent
4d77c474
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/faust_linear_operator/faust_Timer.cpp
+16
-5
16 additions, 5 deletions
src/faust_linear_operator/faust_Timer.cpp
src/faust_linear_operator/faust_Timer.h
+12
-0
12 additions, 0 deletions
src/faust_linear_operator/faust_Timer.h
with
28 additions
and
5 deletions
src/faust_linear_operator/faust_Timer.cpp
+
16
−
5
View file @
a026a3ad
...
...
@@ -11,10 +11,13 @@ Faust::Timer::Timer() : isRunning(false), result(0.0f), nbCall(0)
#if defined(_WIN32)
QueryPerformanceFrequency
(
&
frequency
);
#elif !defined(__linux__)
#elif defined(__MACH__)
mach_timebase_info_data_t
timebase
;
mach_timebase_info
(
&
timebase
);
conversion_factor
=
(
double
)
timebase
.
numer
/
((
double
)
timebase
.
denom
*
1e9
);
#elif defined(__linux__)
#else
handleError
(
class_name
,
"Error in Faust::Timer::Timer : OS not supported"
);
#endif
}
...
...
@@ -25,8 +28,10 @@ void Faust::Timer::start()
{
handleError
(
class_name
,
"Faust::Timer::start : timer is already started.
\n
"
);
}
#if defined(__linux__)
#if defined(__linux__)
clock_gettime
(
CLOCK_MONOTONIC
,
&
debut
);
#elif defined(__MACH__)
debut
=
mach_absolute_time
();
#elif defined(_WIN32)
QueryPerformanceCounter
(
&
debut
);
#endif
...
...
@@ -45,6 +50,10 @@ void Faust::Timer::stop()
struct
timespec
fin
;
clock_gettime
(
CLOCK_MONOTONIC
,
&
fin
);
result
+=
(
fin
.
tv_sec
-
debut
.
tv_sec
)
+
(
fin
.
tv_nsec
-
debut
.
tv_nsec
)
/
1000000000.0
;
#elif defined(__MACH__)
uint64_t
fin
;
fin
=
mach_absolute_time
();
result
+=
((
double
)
(
fin
-
debut
))
*
conversion_factor
;
#elif defined(_WIN32)
LARGE_INTEGER
fin
;
QueryPerformanceCounter
(
&
fin
);
...
...
@@ -62,7 +71,9 @@ void Faust::Timer::reset()
{
#if defined(__linux__)
clock_gettime
(
CLOCK_MONOTONIC
,
&
debut
);
#elif defined(_WIN32)
#elif defined(__MACH__)
debut
=
mach_absolute_time
();
#elif defined(_WIN32)
QueryPerformanceCounter
(
&
debut
);
#endif
cerr
<<
class_name
<<
"reset : timer has been reset while it was running"
<<
endl
;
...
...
This diff is collapsed.
Click to expand it.
src/faust_linear_operator/faust_Timer.h
+
12
−
0
View file @
a026a3ad
...
...
@@ -6,8 +6,15 @@
#if defined(_WIN32)
#include
<windows.h>
#elif defined(__MACH__)
#include
<mach/clock.h>
#include
<mach/mach_time.h>
#endif
/*! \class Faust::Timer
* \brief The class Faust::Timer propose various Transform to evaluate time processing.
*/
...
...
@@ -36,6 +43,9 @@ namespace Faust
float
result
;
#if defined(__linux__)
struct
timespec
debut
;
#elif defined(__MACH__)
uint64_t
debut
;
double
conversion_factor
;
#elif defined(_WIN32)
LARGE_INTEGER
debut
;
LARGE_INTEGER
frequency
;
...
...
@@ -44,6 +54,8 @@ namespace Faust
};
}
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment