|
|
@@ -1,13 +1,13 @@
|
|
|
#include <assert.h>
|
|
|
/*
|
|
|
- * Copyright (c) 2006 Red Hat, Inc.
|
|
|
+ * Copyright (c) 2006, 2009 Red Hat, Inc.
|
|
|
*
|
|
|
* All rights reserved.
|
|
|
*
|
|
|
* Author: Steven Dake (sdake@redhat.com)
|
|
|
*
|
|
|
* This software licensed under BSD license, the text of which follows:
|
|
|
- *
|
|
|
+ *
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
*
|
|
|
@@ -67,9 +67,9 @@
|
|
|
} while (0)
|
|
|
#endif
|
|
|
|
|
|
-int alarm_notice;
|
|
|
+static int alarm_notice;
|
|
|
|
|
|
-void cpg_bm_confchg_fn (
|
|
|
+static void cpg_bm_confchg_fn (
|
|
|
cpg_handle_t handle,
|
|
|
struct cpg_name *group_name,
|
|
|
struct cpg_address *member_list, int member_list_entries,
|
|
|
@@ -78,9 +78,9 @@ void cpg_bm_confchg_fn (
|
|
|
{
|
|
|
}
|
|
|
|
|
|
-unsigned int write_count;
|
|
|
+static unsigned int write_count;
|
|
|
|
|
|
-void cpg_bm_deliver_fn (
|
|
|
+static void cpg_bm_deliver_fn (
|
|
|
cpg_handle_t handle,
|
|
|
struct cpg_name *group_name,
|
|
|
uint32_t nodeid,
|
|
|
@@ -91,14 +91,14 @@ void cpg_bm_deliver_fn (
|
|
|
write_count++;
|
|
|
}
|
|
|
|
|
|
-cpg_callbacks_t callbacks = {
|
|
|
+static cpg_callbacks_t callbacks = {
|
|
|
.cpg_deliver_fn = cpg_bm_deliver_fn,
|
|
|
.cpg_confchg_fn = cpg_bm_confchg_fn
|
|
|
};
|
|
|
|
|
|
-char data[500000];
|
|
|
+static char data[500000];
|
|
|
|
|
|
-void cpg_benchmark (
|
|
|
+static void cpg_benchmark (
|
|
|
cpg_handle_t handle,
|
|
|
int write_size)
|
|
|
{
|
|
|
@@ -138,15 +138,15 @@ retry:
|
|
|
|
|
|
printf ("%5d messages received ", write_count);
|
|
|
printf ("%5d bytes per write ", write_size);
|
|
|
- printf ("%7.3f Seconds runtime ",
|
|
|
+ printf ("%7.3f Seconds runtime ",
|
|
|
(tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)));
|
|
|
printf ("%9.3f TP/s ",
|
|
|
((float)write_count) / (tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)));
|
|
|
- printf ("%7.3f MB/s.\n",
|
|
|
+ printf ("%7.3f MB/s.\n",
|
|
|
((float)write_count) * ((float)write_size) / ((tv_elapsed.tv_sec + (tv_elapsed.tv_usec / 1000000.0)) * 1000000.0));
|
|
|
}
|
|
|
|
|
|
-void sigalrm_handler (int num)
|
|
|
+static void sigalrm_handler (int num)
|
|
|
{
|
|
|
alarm_notice = 1;
|
|
|
}
|
|
|
@@ -161,7 +161,7 @@ int main (void) {
|
|
|
unsigned int size;
|
|
|
int i;
|
|
|
unsigned int res;
|
|
|
-
|
|
|
+
|
|
|
size = 1000;
|
|
|
signal (SIGALRM, sigalrm_handler);
|
|
|
res = cpg_initialize (&handle, &callbacks);
|
|
|
@@ -169,7 +169,7 @@ int main (void) {
|
|
|
printf ("cpg_initialize failed with result %d\n", res);
|
|
|
exit (1);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
res = cpg_join (handle, &group_name);
|
|
|
if (res != CS_OK) {
|
|
|
printf ("cpg_join failed with result %d\n", res);
|