Revision: 7832
Author: [email protected]
Date: Wed Mar 31 17:07:40 2010
Log: Add timings, separate detach from destructor.

http://code.google.com/p/google-web-toolkit/source/detail?r=7832

Modified:
 /changes/jat/csproto/plugins/platform/Linux/Futex.cpp
 /changes/jat/csproto/plugins/platform/Linux/Makefile
 /changes/jat/csproto/plugins/platform/Linux/ShmFutex.cpp
 /changes/jat/csproto/plugins/platform/Linux/ShmFutex.h
 /changes/jat/csproto/plugins/platform/Linux/futextest.cpp

=======================================
--- /changes/jat/csproto/plugins/platform/Linux/Futex.cpp Wed Mar 31 12:05:41 2010 +++ /changes/jat/csproto/plugins/platform/Linux/Futex.cpp Wed Mar 31 17:07:40 2010
@@ -36,7 +36,9 @@
 //
// Timings vary significantly due to caching behavior, but this table collects
 // observed spins per microsecond (.10 and .90 percentiles):
-//    Core2 i7 930 @ 2.8GHz                                  800-2200
+//    Intel Core2 i7 930 @ 2.8GHz, 32/64-bit     800-2200
+//    AMD Opteron 8214HE @ 2.2GHz, 64-bit        450-700
+// AMD Opteron 8214HE @ 2.2GHz, 32-bit 400-700 (avg worse than 64bit)
 //
 #define SPIN_MAX 1000000

=======================================
--- /changes/jat/csproto/plugins/platform/Linux/Makefile Wed Mar 31 09:29:51 2010 +++ /changes/jat/csproto/plugins/platform/Linux/Makefile Wed Mar 31 17:07:40 2010
@@ -1,4 +1,7 @@
-CFLAGS = -O4
+#ARCHFLAGS = -m32 -march=i686
+ARCHFLAGS =
+
+CFLAGS = -O4 $(ARCHFLAGS)
 CXXFLAGS = $(CFLAGS)

 OBJ = obj
@@ -16,7 +19,7 @@

 $(OBJS): $(OBJ)

-$(OBJ)/%.o: %.cpp
+$(OBJ)/%.o: %.cpp $(OBJ)
        $(CXX) $(CXXFLAGS) -c -o $@ -I. $<

 futextest: $(OBJ)/futextest.o $(OBJS)
=======================================
--- /changes/jat/csproto/plugins/platform/Linux/ShmFutex.cpp Wed Mar 31 09:29:51 2010 +++ /changes/jat/csproto/plugins/platform/Linux/ShmFutex.cpp Wed Mar 31 17:07:40 2010
@@ -81,8 +81,12 @@
   }
 }

-// detach this memory segment
+// detach this memory segment, destroy futexes
 ShmFutex::~ShmFutex() {
+  detach();
+}
+
+void ShmFutex::detach() {
   shmdt(this);
 }

=======================================
--- /changes/jat/csproto/plugins/platform/Linux/ShmFutex.h Wed Mar 31 10:18:10 2010 +++ /changes/jat/csproto/plugins/platform/Linux/ShmFutex.h Wed Mar 31 17:07:40 2010
@@ -35,7 +35,8 @@
   // remove the identifier associated with a key
   static void removeKey(const char* key);

-  // only call this explicitly, as in p->~ShmFutex()
+  // only call this explicitly, as in p->~ShmFutex(), and only by the owner
+  // (ie, the one that called creteSegment).
   ~ShmFutex();

   void beginClientRead() { serverToClient.beginRead(); }
@@ -58,6 +59,8 @@
     return serverToClient.beginWrite(wantTimeout);
   }
   void endServerWrite() { serverToClient.endWrite(); }
+
+  void detach();

   volatile char* getClientToServerBuf() { return clientToServer.getBuf(); }
   volatile char* getServerToClientBuf() { return serverToClient.getBuf(); }
=======================================
--- /changes/jat/csproto/plugins/platform/Linux/futextest.cpp Wed Mar 31 12:05:41 2010 +++ /changes/jat/csproto/plugins/platform/Linux/futextest.cpp Wed Mar 31 17:07:40 2010
@@ -23,7 +23,7 @@

 #define PACKET_SIZE_CS 96
 #define PACKET_SIZE_SC 151
-#define NUM_PACKETS 300000
+#define NUM_PACKETS 800000

 static inline void readPacket(volatile char* buf, int len) {
   //return;
@@ -117,6 +117,6 @@
       exit(1);
     }
     runClient(shm);
-    shm->~ShmFutex();
+    shm->detach();
   }
 }

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to