Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
2579fd52
Commit
2579fd52
authored
May 16, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed time measuring functions (only for profiling in debug)
parent
733e5a55
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
profile.h
common/profile.h
+7
-9
No files found.
common/profile.h
View file @
2579fd52
...
@@ -24,8 +24,7 @@
...
@@ -24,8 +24,7 @@
/**
/**
* @file profile.h:
* @file profile.h:
* @brief Simple profiling functions for measuring code execution time. Currently only Linux is
* @brief Simple profiling functions for measuring code execution time.
* supported.
*/
*/
#ifndef __PROFILE_H
#ifndef __PROFILE_H
...
@@ -91,20 +90,18 @@ static __inline__ unsigned long long rdtsc()
...
@@ -91,20 +90,18 @@ static __inline__ unsigned long long rdtsc()
// Fixme: OS X version
// Fixme: OS X version
/**
/**
* Function get_tics
* Function get_tics
* Returns the number of mi
lli
seconds that have elapsed since the system was started.
* Returns the number of mi
cro
seconds that have elapsed since the system was started.
* @return uint64_t Number of mi
lli
seconds.
* @return uint64_t Number of mi
cro
seconds.
*/
*/
static
inline
uint64_t
get_tics
()
static
inline
uint64_t
get_tics
()
{
{
#if defined(__linux__)
#if defined(__linux__)
struct
timezone
tz
=
{
0
,
0
};
struct
timeval
tv
;
struct
timeval
tv
;
gettimeofday
(
&
tv
,
&
tz
);
gettimeofday
(
&
tv
,
NULL
);
return
(
uint64_t
)
tv
.
tv_sec
*
1000000ULL
+
(
uint64_t
)
tv
.
tv_usec
;
return
(
uint64_t
)
tv
.
tv_sec
*
1000000ULL
+
(
uint64_t
)
tv
.
tv_usec
;
#elif defined _WIN32 || defined _WIN64
#elif defined _WIN32 || defined _WIN64
// TODO to be tested
return
GetTickCount
()
*
1000
;
return
GetTickCount
();
#else
#else
return
0
;
return
0
;
#endif
#endif
...
@@ -125,7 +122,8 @@ struct prof_counter
...
@@ -125,7 +122,8 @@ struct prof_counter
* Begins code execution time counting for a given profiling counter.
* Begins code execution time counting for a given profiling counter.
* @param cnt is the counter which should be started.
* @param cnt is the counter which should be started.
* @param use_rdtsc tells if processor's time-stamp counter should be used for time counting.
* @param use_rdtsc tells if processor's time-stamp counter should be used for time counting.
* Otherwise is system tics method will be used.
* Otherwise is system tics method will be used. IMPORTANT: time-stamp counter should not
* be used on multicore machines executing threaded code.
*/
*/
static
inline
void
prof_start
(
prof_counter
*
cnt
,
bool
use_rdtsc
)
static
inline
void
prof_start
(
prof_counter
*
cnt
,
bool
use_rdtsc
)
{
{
...
...
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