[jboss-cvs] JBoss Messaging SVN: r7153 - trunk/native/src.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jun 1 23:26:49 EDT 2009


Author: clebert.suconic at jboss.com
Date: 2009-06-01 23:26:49 -0400 (Mon, 01 Jun 2009)
New Revision: 7153

Added:
   trunk/native/src/disktest.cpp
Modified:
   trunk/native/src/Makefile.am
Log:
Adding disktest.cpp to validate performance (not final)

Modified: trunk/native/src/Makefile.am
===================================================================
--- trunk/native/src/Makefile.am	2009-06-01 20:51:26 UTC (rev 7152)
+++ trunk/native/src/Makefile.am	2009-06-02 03:26:49 UTC (rev 7153)
@@ -1,8 +1,12 @@
 #AM_CXXFLAGS = $(JVM_CXXFLAGS)
 lib_LTLIBRARIES = libJBMLibAIO.la
+bin_PROGRAMS = disktest
 
 libJBMLibAIO_la_SOURCES = AIOController.cpp AIOController.h AIOException.h AsyncFile.cpp \
                      AsyncFile.h CallbackAdapter.h JAIODatatypes.h JavaUtilities.cpp \
                      JavaUtilities.h JNICallbackAdapter.cpp JNICallbackAdapter.h LibAIOController.cpp \
                      LockClass.h org_jboss_messaging_core_persistence_impl_libaio_jni_impl_AsynchronousFileImpl.h \
                      Version.h
+
+disktest_SOURCES = disktest.cpp
+

Added: trunk/native/src/disktest.cpp
===================================================================
--- trunk/native/src/disktest.cpp	                        (rev 0)
+++ trunk/native/src/disktest.cpp	2009-06-02 03:26:49 UTC (rev 7153)
@@ -0,0 +1,55 @@
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <libaio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+
+int main(int arg, char * param[])
+{
+   char * directory;
+   int numberOfFiles;
+   int fileSize = 10 * 1024 * 1024;
+   int bufferSize = 1024 * 1024;
+   void * preAllocBuffer = 0;
+   int i = 0;
+
+   if (arg != 3)
+   {
+       fprintf (stderr, "usage disktest <directory> <numberOfFiles>\n");
+       exit(-1);
+   }
+
+   directory = param[1];
+   numberOfFiles = atoi(param[2]);
+   fileSize = atoi(param[3]);
+   bufferSize = atoi(param[4]);
+
+   fprintf (stderr, "allocating file");
+   if (posix_memalign(&preAllocBuffer, 512, bufferSize))
+   {
+       fprintf (stderr, "Error allocating buffer");
+       exit(-1);
+   }
+
+   for (i = 0 ; i < numberOfFiles; i++)
+   {
+      fprintf (stderr, "I'm here\n");
+      char file[1024];
+      sprintf (file, "%s/file%d.dat", directory, i);
+      fprintf (stderr, "creating file %s\n", file);
+      open (file, O_RDWR | O_CREAT | O_DIRECT, 0666);
+   }
+
+
+   
+
+   
+
+   
+   return (0);
+
+   
+}




More information about the jboss-cvs-commits mailing list