aboutsummaryrefslogtreecommitdiff
path: root/generic/perfos.c
diff options
context:
space:
mode:
authorlecoanet2003-04-16 09:49:22 +0000
committerlecoanet2003-04-16 09:49:22 +0000
commit3261805fee19e346b4d1f84b23816daa1628764a (patch)
tree63ca1d7e4b0a3d9ae49cc0888e58033c3ef3fe22 /generic/perfos.c
parenteed2656db0adae2c234c3d74af0913746ed5c444 (diff)
downloadtkzinc-3261805fee19e346b4d1f84b23816daa1628764a.zip
tkzinc-3261805fee19e346b4d1f84b23816daa1628764a.tar.gz
tkzinc-3261805fee19e346b4d1f84b23816daa1628764a.tar.bz2
tkzinc-3261805fee19e346b4d1f84b23816daa1628764a.tar.xz
Update from the Windows port and general cleanup/restructure
Diffstat (limited to 'generic/perfos.c')
-rw-r--r--generic/perfos.c75
1 files changed, 39 insertions, 36 deletions
diff --git a/generic/perfos.c b/generic/perfos.c
index df7af11..3a0847a 100644
--- a/generic/perfos.c
+++ b/generic/perfos.c
@@ -26,13 +26,13 @@
*
*/
+#ifndef _WIN32
#include "perfos.h"
#include "List.h"
#include "Types.h"
#include <X11/Xutil.h>
-#include <malloc.h>
static const char rcsid[] = "$Id$";
@@ -50,7 +50,8 @@ static ZnList Chronos = NULL;
**********************************************************************************
*/
static void
-HardwareSynchronize(Display *test_display, Drawable test_window)
+HardwareSynchronize(Display *test_display __unused,
+ Drawable test_window __unused)
{
/*XImage *image;*/
@@ -139,12 +140,12 @@ XCorrectionValue(Display *display, Drawable window)
/*
**********************************************************************************
*
- * XStartChrono - Start a perf chrono with X synchronize.
+ * ZnXStartChrono - Start a perf chrono with X synchronize.
*
**********************************************************************************
*/
void
-XStartChrono(Chrono chrono, Display *display, Drawable window)
+ZnXStartChrono(ZnChrono chrono, Display *display, Drawable window)
{
chrono->current_correction = XCorrectionValue(display, window);
chrono->current_delay = XGetCurrentTime(display, window);
@@ -154,12 +155,12 @@ XStartChrono(Chrono chrono, Display *display, Drawable window)
/*
**********************************************************************************
*
- * XStopChrono - Stop a perf chrono with X synchronize.
+ * ZnXStopChrono - Stop a perf chrono with X synchronize.
*
**********************************************************************************
*/
void
-XStopChrono(Chrono chrono, Display *display, Drawable window)
+ZnXStopChrono(ZnChrono chrono, Display *display, Drawable window)
{
chrono->total_delay = chrono->total_delay +
(XGetCurrentTime(display, window) -
@@ -171,12 +172,12 @@ XStopChrono(Chrono chrono, Display *display, Drawable window)
/*
**********************************************************************************
*
- * StartChrono - Start a perf chrono in user time.
+ * ZnStartChrono - Start a perf chrono in user time.
*
**********************************************************************************
*/
void
-StartChrono(Chrono chrono)
+ZnStartChrono(ZnChrono chrono)
{
chrono->current_delay = GetCurrentTime();
}
@@ -185,12 +186,12 @@ StartChrono(Chrono chrono)
/*
**********************************************************************************
*
- * StopChrono - Stop a perf chrono in user time.
+ * ZnStopChrono - Stop a perf chrono in user time.
*
**********************************************************************************
*/
void
-StopChrono(Chrono chrono)
+ZnStopChrono(ZnChrono chrono)
{
chrono->total_delay = chrono->total_delay + (GetCurrentTime() - chrono->current_delay);
chrono->actions++;
@@ -200,12 +201,12 @@ StopChrono(Chrono chrono)
/*
**********************************************************************************
*
- * StartUCChrono - Start a perf chrono in uc time.
+ * ZnStartUCChrono - Start a perf chrono in uc time.
*
**********************************************************************************
*/
void
-StartUCChrono(Chrono chrono)
+ZnStartUCChrono(ZnChrono chrono)
{
chrono->current_delay = GetUCTime();
}
@@ -214,12 +215,12 @@ StartUCChrono(Chrono chrono)
/*
**********************************************************************************
*
- * StopUCChrono - Stop a perf chrono in uc time.
+ * ZnStopUCChrono - Stop a perf chrono in uc time.
*
**********************************************************************************
*/
void
-StopUCChrono(Chrono chrono)
+ZnStopUCChrono(ZnChrono chrono)
{
chrono->total_delay = chrono->total_delay + (GetUCTime() - chrono->current_delay);
chrono->actions++;
@@ -229,19 +230,19 @@ StopUCChrono(Chrono chrono)
/*
**********************************************************************************
*
- * PrintChronos - Print the currently available stats on all
+ * ZnPrintChronos - Print the currently available stats on all
* chronos registered so far.
*
**********************************************************************************
*/
void
-PrintChronos(void)
+ZnPrintChronos(void)
{
int i, cnt;
- Chrono *chrs;
+ ZnChrono *chrs;
cnt = ZnListSize(Chronos);
- chrs = (Chrono *) ZnListArray(Chronos);
+ chrs = (ZnChrono *) ZnListArray(Chronos);
for (i = 0; i < cnt; i++) {
if (chrs[i]->actions != 0) {
printf("%s : %ld ms on %d times\n",
@@ -256,14 +257,14 @@ PrintChronos(void)
/*
**********************************************************************************
*
- * GetChrono - Return the number of runs and the total time of the Chrono.
+ * ZnGetChrono - Return the number of runs and the total time of the Chrono.
*
**********************************************************************************
*/
void
-GetChrono(Chrono chrono,
- long *time,
- int *actions)
+ZnGetChrono(ZnChrono chrono,
+ long *time,
+ int *actions)
{
if (time) {
*time = chrono->total_delay*10;
@@ -277,15 +278,15 @@ GetChrono(Chrono chrono,
/*
**********************************************************************************
*
- * ResetChronos - Reset all chronos or only the specified.
+ * ZnResetChronos - Reset all chronos or only the specified.
*
**********************************************************************************
*/
void
-ResetChronos(Chrono chrono)
+ZnResetChronos(ZnChrono chrono)
{
int i, cnt;
- Chrono *chrs;
+ ZnChrono *chrs;
if (chrono) {
chrono->actions = 0;
@@ -293,7 +294,7 @@ ResetChronos(Chrono chrono)
}
else {
cnt = ZnListSize(Chronos);
- chrs = (Chrono *) ZnListArray(Chronos);
+ chrs = (ZnChrono *) ZnListArray(Chronos);
for (i = 0; i < cnt; i++) {
chrs[i]->actions = 0;
chrs[i]->total_delay = 0;
@@ -305,21 +306,21 @@ ResetChronos(Chrono chrono)
/*
**********************************************************************************
*
- * NewChrono - Return a new initialized chrono associated with
+ * ZnNewChrono - Return a new initialized chrono associated with
* message.
*
**********************************************************************************
*/
-Chrono
-NewChrono(char *message)
+ZnChrono
+ZnNewChrono(char *message)
{
- Chrono new;
+ ZnChrono new;
if (!Chronos) {
- Chronos = ZnListNew(8, sizeof(Chrono));
+ Chronos = ZnListNew(8, sizeof(ZnChrono));
}
- new = (Chrono) ZnMalloc(sizeof(ChronoRec));
+ new = (ZnChrono) ZnMalloc(sizeof(ZnChronoRec));
new->actions = 0;
new->total_delay = 0;
new->message = message;
@@ -332,15 +333,15 @@ NewChrono(char *message)
/*
**********************************************************************************
*
- * FreeChrono - Free the resources of a chrono.
+ * ZnFreeChrono - Free the resources of a chrono.
*
**********************************************************************************
*/
void
-FreeChrono(Chrono chrono)
+ZnFreeChrono(ZnChrono chrono)
{
- int i;
- Chrono *chrs = ZnListArray(Chronos);
+ int i;
+ ZnChrono *chrs = ZnListArray(Chronos);
ZnFree(chrono);
@@ -351,3 +352,5 @@ FreeChrono(Chrono chrono)
}
}
}
+
+#endif /* _WIN32 */