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
3421863c
Commit
3421863c
authored
Jan 13, 2012
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add GetRunningMicroSecs() to libcommon for debug timing
parent
f40a9256
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
85 additions
and
27 deletions
+85
-27
PerformFeatureChecks.cmake
CMakeModules/PerformFeatureChecks.cmake
+9
-1
config.h.cmake
CMakeModules/config.h.cmake
+3
-0
CMakeLists.txt
common/CMakeLists.txt
+1
-0
getrunningmicrosecs.cpp
common/getrunningmicrosecs.cpp
+62
-0
container_test.cpp
container_test.cpp
+1
-17
common.h
include/common.h
+8
-0
kicad_plugin.cpp
pcbnew/kicad_plugin.cpp
+1
-9
No files found.
CMakeModules/PerformFeatureChecks.cmake
View file @
3421863c
...
...
@@ -39,6 +39,9 @@
macro
(
perform_feature_checks
)
include
(
CheckIncludeFile
)
#include(CheckFunctionExists)
include
(
CheckLibraryExists
)
include
(
CheckSymbolExists
)
check_include_file
(
"malloc.h"
HAVE_MALLOC_H
)
...
...
@@ -55,7 +58,6 @@ macro(perform_feature_checks)
# re-introduce this.
# check_include_file("strings.h" HAVE_STRINGS_H)
include
(
CheckSymbolExists
)
check_symbol_exists
(
strcasecmp
"string.h"
HAVE_STRCASECMP
)
check_symbol_exists
(
strcasecmp
"strings.h"
HAVE_STRCASECMP
)
check_symbol_exists
(
strncasecmp
"string.h"
HAVE_STRNCASECMP
)
...
...
@@ -70,6 +72,12 @@ macro(perform_feature_checks)
check_symbol_exists
(
_snprintf
"stdio.h"
HAVE_ISO_SNPRINTF
)
check_symbol_exists
(
_hypot
"math.h"
HAVE_ISO_HYPOT
)
#check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME) non-standard library, does not work
check_library_exists
(
rt clock_gettime
""
HAVE_CLOCK_GETTIME
)
# HAVE_GETTIMEOFDAY is already in use within 2.9 wxWidgets, so use HAVE_GETTIMEOFDAY_FUNC
check_symbol_exists
(
gettimeofday
"sys/time.h"
HAVE_GETTIMEOFDAY_FUNC
)
# Generate config.h.
configure_file
(
${
PROJECT_SOURCE_DIR
}
/CMakeModules/config.h.cmake
${
CMAKE_BINARY_DIR
}
/config.h
)
...
...
CMakeModules/config.h.cmake
View file @
3421863c
...
...
@@ -23,6 +23,9 @@
#define hypot _hypot
#endif
#cmakedefine HAVE_CLOCK_GETTIME
#cmakedefine HAVE_GETTIMEOFDAY_FUNC
#cmakedefine MALLOC_IN_STDLIB_H
#if !defined( MALLOC_IN_STDLIB_H )
...
...
common/CMakeLists.txt
View file @
3421863c
...
...
@@ -54,6 +54,7 @@ set(COMMON_SRCS
eda_doc.cpp
filter_reader.cpp
gestfich.cpp
getrunningmicrosecs.cpp
gr_basic.cpp
hotkeys_basic.cpp
hotkey_grid_table.cpp
...
...
common/getrunningmicrosecs.cpp
0 → 100644
View file @
3421863c
#include <config.h>
#if defined(HAVE_CLOCK_GETTIME)
#include <time.h>
unsigned
GetRunningMicroSecs
()
{
struct
timespec
now
;
clock_gettime
(
CLOCK_MONOTONIC
,
&
now
);
unsigned
usecs
=
((
unsigned
)
now
.
tv_nsec
)
/
1000
+
((
unsigned
)
now
.
tv_sec
)
*
1000000
;
// unsigned msecs = (now.tv_nsec / (1000*1000)) + now.tv_sec * 1000;
return
usecs
;
}
#elif defined(HAVE_GETTIMEOFDAY_FUNC)
#include <sys/time.h>
unsigned
GetRunningMicroSecs
()
{
timeval
tv
;
gettimeofday
(
&
tv
,
0
);
return
(
tv
.
tv_sec
*
1000000
)
+
tv
.
tv_usec
;
}
#elif defined(_WIN32)
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#include <assert.h>
unsigned
GetRunningMicroSecs
()
{
LARGE_INTEGER
curtime
;
static
unsigned
timerFreq
;
// timer frequency
if
(
!
timerFreq
)
{
QueryPerformanceFrequency
(
&
curtime
);
timerFreq
=
curtime
.
QuadPart
/
1000000
;
// i.e., ticks per usec
assert
(
timerFreq
);
}
QueryPerformanceCounter
(
&
curtime
);
return
(
curtime
.
LowPart
/
timerFreq
);
}
#endif
container_test.cpp
View file @
3421863c
...
...
@@ -4,7 +4,7 @@
#include <deque>
#include <dlist.h>
#include <time.h>
#include <common.h>
#define TEST_NODES 100000000
...
...
@@ -16,22 +16,6 @@ typedef boost::ptr_vector<EDA_ITEM> EDA_ITEMV;
void
heap_warm_up
();
/**
* Function GetRunningMicroSecs
* returns current relative time in microsecs.
*/
unsigned
GetRunningMicroSecs
()
{
struct
timespec
now
;
clock_gettime
(
CLOCK_MONOTONIC
,
&
now
);
unsigned
usecs
=
now
.
tv_nsec
/
1000
+
now
.
tv_sec
*
1000
*
1000
;
return
usecs
;
}
int
main
(
int
argc
,
char
**
argv
)
{
EDA_ITEMV
v
;
...
...
include/common.h
View file @
3421863c
...
...
@@ -506,4 +506,12 @@ int From_User_Unit( EDA_UNITS_T aUnit, double val, int internal_unit_value );
*/
wxString
GenDate
();
/**
* Function GetRunningMicroSecs
* returns an ever increasing indication of elapsed microseconds. Use this
* by computing differences between two calls.
* @author Dick Hollenbeck
*/
unsigned
GetRunningMicroSecs
();
#endif // INCLUDE__COMMON_H_
pcbnew/kicad_plugin.cpp
View file @
3421863c
...
...
@@ -60,7 +60,6 @@
#include <auto_ptr.h>
#include <kicad_string.h>
#include <macros.h>
//#include <build_version.h>
#include <zones.h>
#ifdef CVPCB
...
...
@@ -256,13 +255,11 @@ void KICAD_PLUGIN::loadAllSections( bool doAppend )
loadPCB_TARGET
();
}
#if defined(PCBNEW)
else
if
(
TESTLINE
(
"$ZONE"
)
)
{
SEGZONE
*
insertBeforeMe
=
doAppend
?
NULL
:
m_board
->
m_Zone
.
GetFirst
();
loadTrackList
(
insertBeforeMe
,
PCB_ZONE_T
);
}
#endif
else
if
(
TESTLINE
(
"$GENERAL"
)
)
{
...
...
@@ -568,8 +565,6 @@ void KICAD_PLUGIN::loadSETUP()
m_board
->
SetOriginAxisPosition
(
wxPoint
(
gx
,
gy
)
);
}
#if 1 // defined(PCBNEW)
else
if
(
TESTLINE
(
"Layers"
)
)
{
int
tmp
=
intParse
(
line
+
SZ
(
"Layers"
)
);
...
...
@@ -786,7 +781,6 @@ void KICAD_PLUGIN::loadSETUP()
GetScreen()->m_GridOrigin.y = Oy;
*/
}
#endif
else
if
(
TESTLINE
(
"$EndSETUP"
)
)
{
...
...
@@ -2846,9 +2840,7 @@ void KICAD_PLUGIN::saveSETUP() const
}
*/
/* @todo no aFrame in a plugin
fprintf( m_fp, "AuxiliaryAxisOrg %s\n", fmtBIUPoint( aFrame->GetOriginAxisPosition() ).c_str() );
*/
fprintf
(
m_fp
,
"AuxiliaryAxisOrg %s
\n
"
,
fmtBIUPoint
(
m_board
->
GetOriginAxisPosition
()
).
c_str
()
);
/* @todo no globals
{
...
...
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