summaryrefslogtreecommitdiff
path: root/pjlib/include/pj
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2005-11-21 16:59:47 +0000
committerBenny Prijono <bennylp@teluu.com>2005-11-21 16:59:47 +0000
commit483dfa9a40e1818c9fd1cc1dd82884ddbf243778 (patch)
treeabc1e115673177003f0ad0d51ba495e4d9f05238 /pjlib/include/pj
parent4a4fe6471b8a930ec49a28cced2f7a5ea55aee26 (diff)
Added rdtsc option for win32 timestamp and added pj_elapsed_msec
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@70 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/include/pj')
-rw-r--r--pjlib/include/pj/config.h24
-rw-r--r--pjlib/include/pj/os.h18
2 files changed, 42 insertions, 0 deletions
diff --git a/pjlib/include/pj/config.h b/pjlib/include/pj/config.h
index 2a8d5c08..ec21a529 100644
--- a/pjlib/include/pj/config.h
+++ b/pjlib/include/pj/config.h
@@ -97,6 +97,7 @@
# undef PJ_HAS_SEMAPHORE
# undef PJ_HAS_EVENT_OBJ
# undef PJ_ENABLE_EXTRA_CHECK
+# undef PJ_EXCEPTION_USE_WIN32_SEH
#endif
/**
@@ -319,6 +320,27 @@
# define PJ_MAX_EXCEPTION_ID 16
#endif
+/**
+ * Should we use Windows Structured Exception Handling (SEH) for the
+ * PJLIB exceptions.
+ *
+ * Default: 0
+ */
+#ifndef PJ_EXCEPTION_USE_WIN32_SEH
+# define PJ_EXCEPTION_USE_WIN32_SEH 0
+#endif
+
+/**
+ * Should we attempt to use Pentium's rdtsc for high resolution
+ * timestamp.
+ *
+ * Default: 0
+ */
+#ifndef PJ_TIMESTAMP_USE_RDTSC
+# define PJ_TIMESTAMP_USE_RDTSC 0
+#endif
+
+
/** @} */
/********************************************************************
@@ -353,11 +375,13 @@
#ifdef __cplusplus
# define PJ_DECL(type) type
# define PJ_DECL_NO_RETURN(type) type PJ_NORETURN
+# define PJ_IDECL_NO_RETURN(type) PJ_INLINE(type) PJ_NORETURN
# define PJ_BEGIN_DECL extern "C" {
# define PJ_END_DECL }
#else
# define PJ_DECL(type) extern type
# define PJ_DECL_NO_RETURN(type) PJ_NORETURN type
+# define PJ_IDECL_NO_RETURN(type) PJ_NORETURN PJ_INLINE(type)
# define PJ_BEGIN_DECL
# define PJ_END_DECL
#endif
diff --git a/pjlib/include/pj/os.h b/pjlib/include/pj/os.h
index 7b03c968..2917a2ab 100644
--- a/pjlib/include/pj/os.h
+++ b/pjlib/include/pj/os.h
@@ -922,6 +922,24 @@ PJ_DECL(pj_time_val) pj_elapsed_time( const pj_timestamp *start,
const pj_timestamp *stop );
/**
+ * Calculate the elapsed time as 32-bit miliseconds.
+ * This function calculates the elapsed time using highest precision
+ * calculation that is available for current platform, considering
+ * whether floating point or 64-bit precision arithmetic is available.
+ * For maximum portability, application should prefer to use this function
+ * rather than calculating the elapsed time by itself.
+ *
+ * @param start The starting timestamp.
+ * @param stop The end timestamp.
+ *
+ * @return Elapsed time in milisecond.
+ *
+ * @see pj_elapsed_time(), pj_elapsed_cycle(), pj_elapsed_nanosec()
+ */
+PJ_DECL(pj_uint32_t) pj_elapsed_msec( const pj_timestamp *start,
+ const pj_timestamp *stop );
+
+/**
* Calculate the elapsed time in 32-bit microseconds.
* This function calculates the elapsed time using highest precision
* calculation that is available for current platform, considering