#include #include #include #include #include #include #include using namespace std; using namespace cmw; int main(int argc, char* argv[]) try { char* endptr = 0; long elements; if (argc > 1) { elements = strtol(argv[1], &endptr, 10); } else { elements = 70000; } vector > vec; for (int k = 1; k <= 20; ++k) { double basis = 3.5; deque dubs; for (int j = 1; j <= elements; ++j) { basis *= (1000/999); dubs.push_back(basis); } vec.push_back(dubs); basis += 1; } SendBufferFile sendbuf; sendbuf.hndl = file_open("eeout"); MovingMsgs msgs(30000000); msgs.Marshal(sendbuf, vec); sendbuf.Flush(); lseek(sendbuf.hndl, 0, SEEK_SET); ReceiveBufferFile buf(30000000); buf.hndl = sendbuf.hndl; timeval before_tv, after_tv; struct timezone tz; vector > vec2; gettimeofday(&before_tv, &tz); buf.GotPacket(); msgs.Receive(buf, vec2); gettimeofday(&after_tv, &tz); if (before_tv.tv_sec != after_tv.tv_sec) { after_tv.tv_usec += 1000000; } long diff = after_tv.tv_usec - before_tv.tv_usec; cout << "That took (microseconds) " << diff << endl; if (vec != vec2) { cout << "The two vectors are not logically equivalent." << endl; } return 1; } catch (failure const & ex) { cout << "failure exception: " << ex.what(); }