├── RunTests ├── IOCPUDP.bat ├── IOCPUDPMT.bat ├── RIOIOCPUDP.bat ├── RIOIOCPUDPMT.bat ├── RIOPolledUDP.bat ├── IOCPUDPMTGQCSEx.bat ├── RIOEventDrivenUDP.bat ├── SimplePolledUDP.bat ├── RIOIOCPPolledUDPMT.bat ├── RIOEventDrivenPolledUDP.bat ├── RIOIOCPUDPMTReaderThread.bat ├── RIOIOCPPolledUDPMTReaderThread.bat ├── RIOIOCPUDPPolledMTReaderThread.bat ├── StartServer.bat ├── IOCPUDP-Counters.txt ├── RIOIOCPUDP-Counters.txt ├── RIOPolledUDP-Counters.txt ├── SimplePolledUDP-Counters.txt ├── update.bat ├── RIOEventDrivenUDP-Counters.txt ├── RIOEventDrivenPolledUDP-Counters.txt ├── IOCPUDPMT-Counters.txt ├── RIOIOCPUDPMT-Counters.txt ├── IOCPUDPMTGQCSEx-Counters.txt ├── RIOIOCPPolledUDPMT-Counters.txt ├── RIOIOCPUDPMTReaderThread-Counters.txt ├── RIOIOCPUDPPolledMTReaderThread-Counters.txt └── RIOIOCPPolledUDPMTReaderThread-Counters.txt ├── .gitignore ├── README.md ├── IOCPUDP ├── stdafx.cpp ├── targetver.h ├── stdafx.h ├── IOCPUDP.sln ├── IOCPUDP.vcxproj.filters ├── IOCPUDP.cpp └── IOCPUDP.vcxproj ├── IOCPUDPMT ├── stdafx.cpp ├── targetver.h ├── stdafx.h ├── IOCPUDPMT.sln ├── IOCPUDPMT.vcxproj.filters └── IOCPUDPMT.cpp ├── RIOIOCPUDP ├── stdafx.cpp ├── targetver.h ├── stdafx.h ├── RIOIOCPUDP.sln ├── RIOIOCPUDP.vcxproj.filters ├── RIOIOCPUDP.cpp └── RIOIOCPUDP.vcxproj ├── RIOIOCPUDPMT ├── stdafx.cpp ├── targetver.h ├── stdafx.h ├── RIOIOCPUDPMT.sln ├── RIOIOCPUDPMT.vcxproj.filters ├── RIOIOCPUDPMT.cpp └── RIOIOCPUDPMT.vcxproj ├── RIOPolledUDP ├── stdafx.cpp ├── targetver.h ├── stdafx.h ├── RIOPolledUDP.sln ├── RIOPolledUDP.vcxproj.filters └── RIOPolledUDP.cpp ├── IOCPUDPMTGQCSEx ├── stdafx.cpp ├── targetver.h ├── stdafx.h ├── IOCPUDPMTGQCSEx.sln ├── IOCPUDPMTGQCSEx.vcxproj.filters └── IOCPUDPMTGQCSEx.cpp ├── RIOEventDrivenUDP ├── stdafx.cpp ├── targetver.h ├── stdafx.h ├── RIOEventDrivenUDP.sln ├── RIOEventDrivenUDP.vcxproj.filters └── RIOEventDrivenUDP.cpp ├── RIOIOCPPolledUDPMT ├── stdafx.cpp ├── targetver.h ├── stdafx.h ├── RIOIOCPPolledUDPMT.sln ├── RIOIOCPPolledUDPMT.vcxproj.filters ├── RIOIOCPPolledUDPMT.cpp └── RIOIOCPPolledUDPMT.vcxproj ├── RIOTest ├── RIOTest │ ├── stdafx.cpp │ ├── targetver.h │ ├── stdafx.h │ ├── RIOTest.vcxproj.filters │ ├── UsesWinsock.cpp │ ├── UsesWinsock.h │ ├── MSWinSock.h │ ├── RIOTest.vcxproj │ └── MSWinSock.cpp └── RIOTest.sln ├── SimplePolledUDP ├── stdafx.cpp ├── targetver.h ├── stdafx.h ├── SimplePolledUDP.sln ├── SimplePolledUDP.vcxproj.filters └── SimplePolledUDP.cpp ├── RIOEventDrivenPolledUDP ├── stdafx.cpp ├── targetver.h ├── stdafx.h ├── RIOEventDrivenPolledUDP.sln ├── RIOEventDrivenPolledUDP.vcxproj.filters └── RIOEventDrivenPolledUDP.cpp ├── RIOIOCPUDPMTReaderThread ├── stdafx.cpp ├── targetver.h ├── stdafx.h ├── RIOIOCPUDPMTReaderThread.sln ├── RIOIOCPUDPMTReaderThread.vcxproj.filters └── RIOIOCPUDPMTReaderThread.cpp ├── RIOUDPTrafficGenerator ├── stdafx.cpp ├── targetver.h ├── stdafx.h ├── RIOUDPTrafficGenerator.sln ├── RIOUDPTrafficGenerator.vcxproj.filters ├── RIOUDPTrafficGenerator.cpp └── RIOUDPTrafficGenerator.vcxproj ├── SimpleUDPTrafficGenerator ├── stdafx.cpp ├── targetver.h ├── stdafx.h ├── SimpleUDPTrafficGenerator.sln ├── SimpleUDPTrafficGenerator.vcxproj.filters └── SimpleUDPTrafficGenerator.cpp ├── RIOIOCPPolledUDPMTReaderThread ├── stdafx.cpp ├── targetver.h ├── stdafx.h ├── RIOIOCPPolledUDPMTReaderThread.sln └── RIOIOCPPolledUDPMTReaderThread.vcxproj.filters ├── Shared └── Constants.h └── LICENSE /RunTests/IOCPUDP.bat: -------------------------------------------------------------------------------- 1 | StartServer IOCPUDP %1% 2 | -------------------------------------------------------------------------------- /RunTests/IOCPUDPMT.bat: -------------------------------------------------------------------------------- 1 | StartServer IOCPUDPMT %1% 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vs 2 | x64 3 | *.user 4 | Release 5 | Debug -------------------------------------------------------------------------------- /RunTests/RIOIOCPUDP.bat: -------------------------------------------------------------------------------- 1 | StartServer RIOIOCPUDP %1% 2 | -------------------------------------------------------------------------------- /RunTests/RIOIOCPUDPMT.bat: -------------------------------------------------------------------------------- 1 | StartServer RIOIOCPUDPMT %1% 2 | -------------------------------------------------------------------------------- /RunTests/RIOPolledUDP.bat: -------------------------------------------------------------------------------- 1 | StartServer RIOPolledUDP %1% 2 | -------------------------------------------------------------------------------- /RunTests/IOCPUDPMTGQCSEx.bat: -------------------------------------------------------------------------------- 1 | StartServer IOCPUDPMTGQCSEx %1% 2 | -------------------------------------------------------------------------------- /RunTests/RIOEventDrivenUDP.bat: -------------------------------------------------------------------------------- 1 | StartServer RIOEventDrivenUDP %1% 2 | -------------------------------------------------------------------------------- /RunTests/SimplePolledUDP.bat: -------------------------------------------------------------------------------- 1 | StartServer SimplePolledUDP %1% 2 | -------------------------------------------------------------------------------- /RunTests/RIOIOCPPolledUDPMT.bat: -------------------------------------------------------------------------------- 1 | StartServer RIOIOCPPolledUDPMT %1% 2 | -------------------------------------------------------------------------------- /RunTests/RIOEventDrivenPolledUDP.bat: -------------------------------------------------------------------------------- 1 | StartServer RIOEventDrivenPolledUDP %1% 2 | -------------------------------------------------------------------------------- /RunTests/RIOIOCPUDPMTReaderThread.bat: -------------------------------------------------------------------------------- 1 | StartServer RIOIOCPUDPMTReaderThread %1% 2 | -------------------------------------------------------------------------------- /RunTests/RIOIOCPPolledUDPMTReaderThread.bat: -------------------------------------------------------------------------------- 1 | StartServer RIOIOCPPolledUDPMTReaderThread %1% 2 | -------------------------------------------------------------------------------- /RunTests/RIOIOCPUDPPolledMTReaderThread.bat: -------------------------------------------------------------------------------- 1 | StartServer RIOIOCPUDPPolledMTReaderThread %1% 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RIO 2 | 3 | Code that explores the Windows Registered I/O Networking Extensions 4 | 5 | Originally written in 2011 to go with the series of articles that start 6 | here: https://serverframework.com/asynchronousevents/2012/03/windows-8-registered-io-example-udp-servers.html 7 | -------------------------------------------------------------------------------- /IOCPUDP/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // RIOTest.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /IOCPUDPMT/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // RIOTest.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /RIOIOCPUDP/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // RIOTest.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /RIOIOCPUDPMT/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // RIOTest.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /RIOPolledUDP/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // RIOTest.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /IOCPUDPMTGQCSEx/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // RIOTest.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /RIOEventDrivenUDP/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // RIOTest.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /RIOIOCPPolledUDPMT/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // RIOTest.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /RIOTest/RIOTest/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // RIOTest.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /SimplePolledUDP/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // RIOTest.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /RIOEventDrivenPolledUDP/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // RIOTest.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /RIOIOCPUDPMTReaderThread/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // RIOTest.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /RIOUDPTrafficGenerator/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // RIOTest.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /IOCPUDP/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /SimpleUDPTrafficGenerator/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // RIOTest.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /IOCPUDPMT/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /RIOIOCPPolledUDPMTReaderThread/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // stdafx.cpp : source file that includes just the standard includes 2 | // RIOTest.pch will be the pre-compiled header 3 | // stdafx.obj will contain the pre-compiled type information 4 | 5 | #include "stdafx.h" 6 | 7 | // TODO: reference any additional headers you need in STDAFX.H 8 | // and not in this file 9 | -------------------------------------------------------------------------------- /RIOIOCPUDP/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /RIOIOCPUDPMT/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /RIOPolledUDP/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /IOCPUDPMTGQCSEx/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /RIOEventDrivenUDP/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /RIOIOCPPolledUDPMT/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /RIOTest/RIOTest/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /SimplePolledUDP/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /RIOEventDrivenPolledUDP/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /RIOUDPTrafficGenerator/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /RIOIOCPUDPMTReaderThread/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /SimpleUDPTrafficGenerator/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /RIOIOCPPolledUDPMTReaderThread/targetver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // Including SDKDDKVer.h defines the highest available Windows platform. 4 | 5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 7 | 8 | #include 9 | -------------------------------------------------------------------------------- /RIOTest/RIOTest/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #include "targetver.h" 9 | 10 | #include 11 | #include 12 | 13 | #include "MSWinSock.h" 14 | #include "UsesWinsock.h" 15 | 16 | 17 | // TODO: reference additional headers your program requires here 18 | -------------------------------------------------------------------------------- /IOCPUDP/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define NOMINMAX 9 | 10 | #include "targetver.h" 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | 19 | // TODO: reference additional headers your program requires here 20 | -------------------------------------------------------------------------------- /IOCPUDPMT/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define NOMINMAX 9 | 10 | #include "targetver.h" 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | 19 | // TODO: reference additional headers your program requires here 20 | -------------------------------------------------------------------------------- /RIOIOCPUDP/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define NOMINMAX 9 | 10 | #include "targetver.h" 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | 19 | // TODO: reference additional headers your program requires here 20 | -------------------------------------------------------------------------------- /RIOIOCPUDPMT/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define NOMINMAX 9 | 10 | #include "targetver.h" 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | 19 | // TODO: reference additional headers your program requires here 20 | -------------------------------------------------------------------------------- /RIOPolledUDP/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define NOMINMAX 9 | 10 | #include "targetver.h" 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | 19 | // TODO: reference additional headers your program requires here 20 | -------------------------------------------------------------------------------- /SimplePolledUDP/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define NOMINMAX 9 | 10 | #include "targetver.h" 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | // TODO: reference additional headers your program requires here 19 | -------------------------------------------------------------------------------- /IOCPUDPMTGQCSEx/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define NOMINMAX 9 | 10 | #include "targetver.h" 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | 19 | // TODO: reference additional headers your program requires here 20 | -------------------------------------------------------------------------------- /RIOEventDrivenUDP/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define NOMINMAX 9 | 10 | #include "targetver.h" 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | 19 | // TODO: reference additional headers your program requires here 20 | -------------------------------------------------------------------------------- /RIOUDPTrafficGenerator/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define NOMINMAX 9 | 10 | #include "targetver.h" 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | 19 | // TODO: reference additional headers your program requires here 20 | -------------------------------------------------------------------------------- /RIOEventDrivenPolledUDP/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define NOMINMAX 9 | 10 | #include "targetver.h" 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | 19 | // TODO: reference additional headers your program requires here 20 | -------------------------------------------------------------------------------- /RIOIOCPUDPMTReaderThread/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define NOMINMAX 9 | 10 | #include "targetver.h" 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | 19 | // TODO: reference additional headers your program requires here 20 | -------------------------------------------------------------------------------- /SimpleUDPTrafficGenerator/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define NOMINMAX 9 | 10 | #include "targetver.h" 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | 19 | // TODO: reference additional headers your program requires here 20 | -------------------------------------------------------------------------------- /RIOIOCPPolledUDPMTReaderThread/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define NOMINMAX 9 | 10 | #include "targetver.h" 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | 19 | // TODO: reference additional headers your program requires here 20 | -------------------------------------------------------------------------------- /RIOIOCPPolledUDPMT/stdafx.h: -------------------------------------------------------------------------------- 1 | // stdafx.h : include file for standard system include files, 2 | // or project specific include files that are used frequently, but 3 | // are changed infrequently 4 | // 5 | 6 | #pragma once 7 | 8 | #define NOMINMAX 9 | 10 | #include "targetver.h" 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | 20 | // TODO: reference additional headers your program requires here 21 | -------------------------------------------------------------------------------- /RunTests/StartServer.bat: -------------------------------------------------------------------------------- 1 | @Echo off 2 | 3 | setlocal 4 | 5 | set NAME=%1% 6 | set WORK=%2% 7 | set EXE_PATH=%NAME%.exe 8 | 9 | Echo Running Test: %NAME% 10 | 11 | logman create counter test -f bin -si 01 -cf %NAME%-Counters.txt -o %NAME% -v mmddhhmm > NUL 12 | logman start test > NUL 13 | 14 | :: Delay for 2 seconds 15 | choice /c delay /t 2 /d y >NUL 16 | 17 | %EXE_PATH% %WORK% 18 | 19 | :: Delay for 2 seconds 20 | choice /c delay /t 2 /d y >NUL 21 | 22 | logman stop test > NUL 23 | logman delete test > NUL 24 | -------------------------------------------------------------------------------- /RunTests/IOCPUDP-Counters.txt: -------------------------------------------------------------------------------- 1 | "\Process(IOCPUDP)\% Privileged Time" 2 | "\Process(IOCPUDP)\% Processor Time" 3 | "\Process(IOCPUDP)\% User Time" 4 | "\Process(IOCPUDP)\IO Other Bytes/sec" 5 | "\Process(IOCPUDP)\IO Other Operations/sec" 6 | "\Process(IOCPUDP)\Pool Nonpaged Bytes" 7 | "\Process(IOCPUDP)\Working Set - Private" 8 | "\Thread(IOCPUDP/0)\Context Switches/sec" 9 | "\Processor(_Total)\% DPC Time" 10 | "\Processor(_Total)\% Interrupt Time" 11 | "\Processor(_Total)\% Privileged Time" 12 | "\Processor(_Total)\% Processor Time" 13 | "\Processor(_Total)\% User Time" 14 | "\Processor(_Total)\Interrupts/sec" 15 | "\UDPv4\Datagrams Received Errors" 16 | "\UDPv4\Datagrams Received/sec" 17 | "\Microsoft Winsock BSP\Dropped Datagrams/sec" 18 | -------------------------------------------------------------------------------- /RunTests/RIOIOCPUDP-Counters.txt: -------------------------------------------------------------------------------- 1 | "\Process(RIOIOCPUDP)\% Privileged Time" 2 | "\Process(RIOIOCPUDP)\% Processor Time" 3 | "\Process(RIOIOCPUDP)\% User Time" 4 | "\Process(RIOIOCPUDP)\IO Other Bytes/sec" 5 | "\Process(RIOIOCPUDP)\IO Other Operations/sec" 6 | "\Process(RIOIOCPUDP)\Pool Nonpaged Bytes" 7 | "\Process(RIOIOCPUDP)\Working Set - Private" 8 | "\Thread(RIOIOCPUDP/0)\Context Switches/sec" 9 | "\Processor(_Total)\% DPC Time" 10 | "\Processor(_Total)\% Interrupt Time" 11 | "\Processor(_Total)\% Privileged Time" 12 | "\Processor(_Total)\% Processor Time" 13 | "\Processor(_Total)\% User Time" 14 | "\Processor(_Total)\Interrupts/sec" 15 | "\UDPv4\Datagrams Received Errors" 16 | "\UDPv4\Datagrams Received/sec" 17 | "\Microsoft Winsock BSP\Dropped Datagrams/sec" 18 | -------------------------------------------------------------------------------- /RunTests/RIOPolledUDP-Counters.txt: -------------------------------------------------------------------------------- 1 | "\Process(RIOPolledUDP)\% Privileged Time" 2 | "\Process(RIOPolledUDP)\% Processor Time" 3 | "\Process(RIOPolledUDP)\% User Time" 4 | "\Process(RIOPolledUDP)\IO Other Bytes/sec" 5 | "\Process(RIOPolledUDP)\IO Other Operations/sec" 6 | "\Process(RIOPolledUDP)\Pool Nonpaged Bytes" 7 | "\Process(RIOPolledUDP)\Working Set - Private" 8 | "\Thread(RIOPolledUDP/0)\Context Switches/sec" 9 | "\Processor(_Total)\% DPC Time" 10 | "\Processor(_Total)\% Interrupt Time" 11 | "\Processor(_Total)\% Privileged Time" 12 | "\Processor(_Total)\% Processor Time" 13 | "\Processor(_Total)\% User Time" 14 | "\Processor(_Total)\Interrupts/sec" 15 | "\UDPv4\Datagrams Received Errors" 16 | "\UDPv4\Datagrams Received/sec" 17 | "\Microsoft Winsock BSP\Dropped Datagrams/sec" 18 | 19 | -------------------------------------------------------------------------------- /RunTests/SimplePolledUDP-Counters.txt: -------------------------------------------------------------------------------- 1 | "\Process(SimplePolledUDP)\% Privileged Time" 2 | "\Process(SimplePolledUDP)\% Processor Time" 3 | "\Process(SimplePolledUDP)\% User Time" 4 | "\Process(SimplePolledUDP)\IO Other Bytes/sec" 5 | "\Process(SimplePolledUDP)\IO Other Operations/sec" 6 | "\Process(SimplePolledUDP)\Pool Nonpaged Bytes" 7 | "\Process(SimplePolledUDP)\Working Set - Private" 8 | "\Thread(SimplePolledUDP/0)\Context Switches/sec" 9 | "\Processor(_Total)\% DPC Time" 10 | "\Processor(_Total)\% Interrupt Time" 11 | "\Processor(_Total)\% Privileged Time" 12 | "\Processor(_Total)\% Processor Time" 13 | "\Processor(_Total)\% User Time" 14 | "\Processor(_Total)\Interrupts/sec" 15 | "\UDPv4\Datagrams Received Errors" 16 | "\UDPv4\Datagrams Received/sec" 17 | "\Microsoft Winsock BSP\Dropped Datagrams/sec" 18 | -------------------------------------------------------------------------------- /RunTests/update.bat: -------------------------------------------------------------------------------- 1 | copy ..\RIOPolledUDP\x64\Release\RIOPolledUDP.exe . /y 2 | copy ..\RIOEventDrivenUDP\x64\Release\RIOEventDrivenUDP.exe . /y 3 | copy ..\RIOEventDrivenPolledUDP\x64\Release\RIOEventDrivenPolledUDP.exe . /y 4 | copy ..\RIOIOCPUDP\x64\Release\RIOIOCPUDP.exe . /y 5 | copy ..\RIOIOCPUDPMT\x64\Release\RIOIOCPUDPMT.exe . /y 6 | copy ..\RIOIOCPPolledUDPMT\x64\Release\RIOIOCPPolledUDPMT.exe . /y 7 | copy ..\RIOIOCPUDPMTReaderThread\x64\Release\RIOIOCPUDPMTReaderThread.exe . /y 8 | copy ..\RIOIOCPPolledUDPMTReaderThread\x64\Release\RIOIOCPPolledUDPMTReaderThread.exe . /y 9 | 10 | copy ..\SimplePolledUDP\x64\Release\SimplePolledUDP.exe . /y 11 | copy ..\IOCPUDP\x64\Release\IOCPUDP.exe . /y 12 | copy ..\IOCPUDPMT\x64\Release\IOCPUDPMT.exe . /y 13 | copy ..\IOCPUDPMTGQCSEx\x64\Release\IOCPUDPMTGQCSEx.exe . /y 14 | -------------------------------------------------------------------------------- /RunTests/RIOEventDrivenUDP-Counters.txt: -------------------------------------------------------------------------------- 1 | "\Process(RIOEventDrivenUDP)\% Privileged Time" 2 | "\Process(RIOEventDrivenUDP)\% Processor Time" 3 | "\Process(RIOEventDrivenUDP)\% User Time" 4 | "\Process(RIOEventDrivenUDP)\IO Other Bytes/sec" 5 | "\Process(RIOEventDrivenUDP)\IO Other Operations/sec" 6 | "\Process(RIOEventDrivenUDP)\Pool Nonpaged Bytes" 7 | "\Process(RIOEventDrivenUDP)\Working Set - Private" 8 | "\Thread(RIOEventDrivenUDP/0)\Context Switches/sec" 9 | "\Processor(_Total)\% DPC Time" 10 | "\Processor(_Total)\% Interrupt Time" 11 | "\Processor(_Total)\% Privileged Time" 12 | "\Processor(_Total)\% Processor Time" 13 | "\Processor(_Total)\% User Time" 14 | "\Processor(_Total)\Interrupts/sec" 15 | "\UDPv4\Datagrams Received Errors" 16 | "\UDPv4\Datagrams Received/sec" 17 | "\Microsoft Winsock BSP\Dropped Datagrams/sec" 18 | -------------------------------------------------------------------------------- /RunTests/RIOEventDrivenPolledUDP-Counters.txt: -------------------------------------------------------------------------------- 1 | "\Process(RIOEventDrivenPolledUDP)\% Privileged Time" 2 | "\Process(RIOEventDrivenPolledUDP)\% Processor Time" 3 | "\Process(RIOEventDrivenPolledUDP)\% User Time" 4 | "\Process(RIOEventDrivenPolledUDP)\IO Other Bytes/sec" 5 | "\Process(RIOEventDrivenPolledUDP)\IO Other Operations/sec" 6 | "\Process(RIOEventDrivenPolledUDP)\Pool Nonpaged Bytes" 7 | "\Process(RIOEventDrivenPolledUDP)\Working Set - Private" 8 | "\Thread(RIOEventDrivenPolledUDP/0)\Context Switches/sec" 9 | "\Processor(_Total)\% DPC Time" 10 | "\Processor(_Total)\% Interrupt Time" 11 | "\Processor(_Total)\% Privileged Time" 12 | "\Processor(_Total)\% Processor Time" 13 | "\Processor(_Total)\% User Time" 14 | "\Processor(_Total)\Interrupts/sec" 15 | "\UDPv4\Datagrams Received Errors" 16 | "\UDPv4\Datagrams Received/sec" 17 | "\Microsoft Winsock BSP\Dropped Datagrams/sec" 18 | -------------------------------------------------------------------------------- /Shared/Constants.h: -------------------------------------------------------------------------------- 1 | 2 | static const DWORD EXPECTED_DATA_SIZE = 1024; 3 | 4 | static const DWORD RECV_BUFFER_SIZE = EXPECTED_DATA_SIZE; 5 | static const DWORD SEND_BUFFER_SIZE = EXPECTED_DATA_SIZE; 6 | 7 | static const long DATAGRAMS_TO_SEND = 50000000; 8 | static const long SHUTDOWN_DATAGRAMS_TO_SEND = 1000; 9 | 10 | static const DWORD RIO_PENDING_RECVS = 150000; 11 | 12 | static const DWORD SPIN_COUNT = 4000; 13 | 14 | static const DWORD RIO_MAX_RESULTS = 1000; 15 | 16 | static const DWORD RIO_RESULTS_THRESHOLD = (RIO_MAX_RESULTS / 3) * 2; 17 | 18 | static const DWORD IOCP_PENDING_RECVS = 5000; 19 | 20 | static const DWORD GQCSEX_MAX_RESULTS = 1000; 21 | 22 | static const unsigned short PORT = 8080; 23 | 24 | static const DWORD TIMING_THREAD_AFFINITY_MASK = 1; 25 | 26 | static const DWORD NUM_IOCP_THREADS = 8; 27 | 28 | static const bool USE_LARGE_PAGES = false; 29 | 30 | #define TRACK_THREAD_STATS 31 | //#define WE_RESET_EVENT 32 | 33 | -------------------------------------------------------------------------------- /RIOTest/RIOTest.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 11 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RIOTest", "RIOTest\RIOTest.vcxproj", "{325A75CE-D7FA-4FA9-91AA-91EDEA761635}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.Build.0 = Debug|Win32 14 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.ActiveCfg = Release|Win32 15 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2011 Len Holgate 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /RunTests/IOCPUDPMT-Counters.txt: -------------------------------------------------------------------------------- 1 | "\Process(IOCPUDPMT)\% Privileged Time" 2 | "\Process(IOCPUDPMT)\% Processor Time" 3 | "\Process(IOCPUDPMT)\% User Time" 4 | "\Process(IOCPUDPMT)\IO Other Bytes/sec" 5 | "\Process(IOCPUDPMT)\IO Other Operations/sec" 6 | "\Process(IOCPUDPMT)\Pool Nonpaged Bytes" 7 | "\Process(IOCPUDPMT)\Working Set - Private" 8 | "\Thread(IOCPUDPMT/0)\Context Switches/sec" 9 | "\Thread(IOCPUDPMT/1)\Context Switches/sec" 10 | "\Thread(IOCPUDPMT/2)\Context Switches/sec" 11 | "\Thread(IOCPUDPMT/3)\Context Switches/sec" 12 | "\Thread(IOCPUDPMT/4)\Context Switches/sec" 13 | "\Thread(IOCPUDPMT/5)\Context Switches/sec" 14 | "\Thread(IOCPUDPMT/6)\Context Switches/sec" 15 | "\Thread(IOCPUDPMT/7)\Context Switches/sec" 16 | "\Thread(IOCPUDPMT/8)\Context Switches/sec" 17 | "\Thread(IOCPUDPMT/9)\Context Switches/sec" 18 | "\Thread(IOCPUDPMT/10)\Context Switches/sec" 19 | "\Processor(_Total)\% DPC Time" 20 | "\Processor(_Total)\% Interrupt Time" 21 | "\Processor(_Total)\% Privileged Time" 22 | "\Processor(_Total)\% Processor Time" 23 | "\Processor(_Total)\% User Time" 24 | "\Processor(_Total)\Interrupts/sec" 25 | "\UDPv4\Datagrams Received Errors" 26 | "\UDPv4\Datagrams Received/sec" 27 | "\Microsoft Winsock BSP\Dropped Datagrams/sec" 28 | -------------------------------------------------------------------------------- /RunTests/RIOIOCPUDPMT-Counters.txt: -------------------------------------------------------------------------------- 1 | "\Process(RIOIOCPUDPMT)\% Privileged Time" 2 | "\Process(RIOIOCPUDPMT)\% Processor Time" 3 | "\Process(RIOIOCPUDPMT)\% User Time" 4 | "\Process(RIOIOCPUDPMT)\IO Other Bytes/sec" 5 | "\Process(RIOIOCPUDPMT)\IO Other Operations/sec" 6 | "\Process(RIOIOCPUDPMT)\Pool Nonpaged Bytes" 7 | "\Process(RIOIOCPUDPMT)\Working Set - Private" 8 | "\Thread(RIOIOCPUDPMT/0)\Context Switches/sec" 9 | "\Thread(RIOIOCPUDPMT/1)\Context Switches/sec" 10 | "\Thread(RIOIOCPUDPMT/2)\Context Switches/sec" 11 | "\Thread(RIOIOCPUDPMT/3)\Context Switches/sec" 12 | "\Thread(RIOIOCPUDPMT/4)\Context Switches/sec" 13 | "\Thread(RIOIOCPUDPMT/5)\Context Switches/sec" 14 | "\Thread(RIOIOCPUDPMT/6)\Context Switches/sec" 15 | "\Thread(RIOIOCPUDPMT/7)\Context Switches/sec" 16 | "\Thread(RIOIOCPUDPMT/8)\Context Switches/sec" 17 | "\Thread(RIOIOCPUDPMT/9)\Context Switches/sec" 18 | "\Thread(RIOIOCPUDPMT/10)\Context Switches/sec" 19 | "\Processor(_Total)\% DPC Time" 20 | "\Processor(_Total)\% Interrupt Time" 21 | "\Processor(_Total)\% Privileged Time" 22 | "\Processor(_Total)\% Processor Time" 23 | "\Processor(_Total)\% User Time" 24 | "\Processor(_Total)\Interrupts/sec" 25 | "\UDPv4\Datagrams Received Errors" 26 | "\UDPv4\Datagrams Received/sec" 27 | "\Microsoft Winsock BSP\Dropped Datagrams/sec" 28 | -------------------------------------------------------------------------------- /IOCPUDP/IOCPUDP.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 11 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IOCPUDP", "IOCPUDP.vcxproj", "{325A75CE-D7FA-4FA9-91AA-91EDEA761635}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Debug|x64 = Debug|x64 10 | Release|Win32 = Release|Win32 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.Build.0 = Debug|Win32 16 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.ActiveCfg = Debug|x64 17 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.Build.0 = Debug|x64 18 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.ActiveCfg = Release|Win32 19 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.Build.0 = Release|Win32 20 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.ActiveCfg = Release|x64 21 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.Build.0 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /IOCPUDPMT/IOCPUDPMT.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 11 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IOCPUDPMT", "IOCPUDPMT.vcxproj", "{325A75CE-D7FA-4FA9-91AA-91EDEA761635}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Debug|x64 = Debug|x64 10 | Release|Win32 = Release|Win32 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.Build.0 = Debug|Win32 16 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.ActiveCfg = Debug|x64 17 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.Build.0 = Debug|x64 18 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.ActiveCfg = Release|Win32 19 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.Build.0 = Release|Win32 20 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.ActiveCfg = Release|x64 21 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.Build.0 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /RIOIOCPUDP/RIOIOCPUDP.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 11 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RIOIOCPUDP", "RIOIOCPUDP.vcxproj", "{325A75CE-D7FA-4FA9-91AA-91EDEA761635}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Debug|x64 = Debug|x64 10 | Release|Win32 = Release|Win32 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.Build.0 = Debug|Win32 16 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.ActiveCfg = Debug|x64 17 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.Build.0 = Debug|x64 18 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.ActiveCfg = Release|Win32 19 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.Build.0 = Release|Win32 20 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.ActiveCfg = Release|x64 21 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.Build.0 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /RIOIOCPUDPMT/RIOIOCPUDPMT.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 11 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RIOIOCPUDPMT", "RIOIOCPUDPMT.vcxproj", "{325A75CE-D7FA-4FA9-91AA-91EDEA761635}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Debug|x64 = Debug|x64 10 | Release|Win32 = Release|Win32 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.Build.0 = Debug|Win32 16 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.ActiveCfg = Debug|x64 17 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.Build.0 = Debug|x64 18 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.ActiveCfg = Release|Win32 19 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.Build.0 = Release|Win32 20 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.ActiveCfg = Release|x64 21 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.Build.0 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /RIOPolledUDP/RIOPolledUDP.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 11 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RIOPolledUDP", "RIOPolledUDP.vcxproj", "{325A75CE-D7FA-4FA9-91AA-91EDEA761635}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Debug|x64 = Debug|x64 10 | Release|Win32 = Release|Win32 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.Build.0 = Debug|Win32 16 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.ActiveCfg = Debug|x64 17 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.Build.0 = Debug|x64 18 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.ActiveCfg = Release|Win32 19 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.Build.0 = Release|Win32 20 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.ActiveCfg = Release|x64 21 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.Build.0 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /RunTests/IOCPUDPMTGQCSEx-Counters.txt: -------------------------------------------------------------------------------- 1 | "\Process(IOCPUDPMTGQCSEx)\% Privileged Time" 2 | "\Process(IOCPUDPMTGQCSEx)\% Processor Time" 3 | "\Process(IOCPUDPMTGQCSEx)\% User Time" 4 | "\Process(IOCPUDPMTGQCSEx)\IO Other Bytes/sec" 5 | "\Process(IOCPUDPMTGQCSEx)\IO Other Operations/sec" 6 | "\Process(IOCPUDPMTGQCSEx)\Pool Nonpaged Bytes" 7 | "\Process(IOCPUDPMTGQCSEx)\Working Set - Private" 8 | "\Thread(IOCPUDPMTGQCSEx/0)\Context Switches/sec" 9 | "\Thread(IOCPUDPMTGQCSEx/1)\Context Switches/sec" 10 | "\Thread(IOCPUDPMTGQCSEx/2)\Context Switches/sec" 11 | "\Thread(IOCPUDPMTGQCSEx/3)\Context Switches/sec" 12 | "\Thread(IOCPUDPMTGQCSEx/4)\Context Switches/sec" 13 | "\Thread(IOCPUDPMTGQCSEx/5)\Context Switches/sec" 14 | "\Thread(IOCPUDPMTGQCSEx/6)\Context Switches/sec" 15 | "\Thread(IOCPUDPMTGQCSEx/7)\Context Switches/sec" 16 | "\Thread(IOCPUDPMTGQCSEx/8)\Context Switches/sec" 17 | "\Thread(IOCPUDPMTGQCSEx/9)\Context Switches/sec" 18 | "\Thread(IOCPUDPMTGQCSEx/10)\Context Switches/sec" 19 | "\Processor(_Total)\% DPC Time" 20 | "\Processor(_Total)\% Interrupt Time" 21 | "\Processor(_Total)\% Privileged Time" 22 | "\Processor(_Total)\% Processor Time" 23 | "\Processor(_Total)\% User Time" 24 | "\Processor(_Total)\Interrupts/sec" 25 | "\UDPv4\Datagrams Received Errors" 26 | "\UDPv4\Datagrams Received/sec" 27 | "\Microsoft Winsock BSP\Dropped Datagrams/sec" 28 | -------------------------------------------------------------------------------- /IOCPUDPMTGQCSEx/IOCPUDPMTGQCSEx.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 11 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IOCPUDPMTGQCSEx", "IOCPUDPMTGQCSEx.vcxproj", "{325A75CE-D7FA-4FA9-91AA-91EDEA761635}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Debug|x64 = Debug|x64 10 | Release|Win32 = Release|Win32 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.Build.0 = Debug|Win32 16 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.ActiveCfg = Debug|x64 17 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.Build.0 = Debug|x64 18 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.ActiveCfg = Release|Win32 19 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.Build.0 = Release|Win32 20 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.ActiveCfg = Release|x64 21 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.Build.0 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /SimplePolledUDP/SimplePolledUDP.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 11 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimplePolledUDP", "SimplePolledUDP.vcxproj", "{325A75CE-D7FA-4FA9-91AA-91EDEA761635}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Debug|x64 = Debug|x64 10 | Release|Win32 = Release|Win32 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.Build.0 = Debug|Win32 16 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.ActiveCfg = Debug|x64 17 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.Build.0 = Debug|x64 18 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.ActiveCfg = Release|Win32 19 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.Build.0 = Release|Win32 20 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.ActiveCfg = Release|x64 21 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.Build.0 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /RIOEventDrivenUDP/RIOEventDrivenUDP.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 11 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RIOEventDrivenUDP", "RIOEventDrivenUDP.vcxproj", "{325A75CE-D7FA-4FA9-91AA-91EDEA761635}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Debug|x64 = Debug|x64 10 | Release|Win32 = Release|Win32 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.Build.0 = Debug|Win32 16 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.ActiveCfg = Debug|x64 17 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.Build.0 = Debug|x64 18 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.ActiveCfg = Release|Win32 19 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.Build.0 = Release|Win32 20 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.ActiveCfg = Release|x64 21 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.Build.0 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /RIOIOCPPolledUDPMT/RIOIOCPPolledUDPMT.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 11 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RIOIOCPPolledUDPMT", "RIOIOCPPolledUDPMT.vcxproj", "{325A75CE-D7FA-4FA9-91AA-91EDEA761635}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Debug|x64 = Debug|x64 10 | Release|Win32 = Release|Win32 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.Build.0 = Debug|Win32 16 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.ActiveCfg = Debug|x64 17 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.Build.0 = Debug|x64 18 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.ActiveCfg = Release|Win32 19 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.Build.0 = Release|Win32 20 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.ActiveCfg = Release|x64 21 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.Build.0 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /RIOEventDrivenPolledUDP/RIOEventDrivenPolledUDP.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 11 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RIOEventDrivenPolledUDP", "RIOEventDrivenPolledUDP.vcxproj", "{325A75CE-D7FA-4FA9-91AA-91EDEA761635}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Debug|x64 = Debug|x64 10 | Release|Win32 = Release|Win32 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.Build.0 = Debug|Win32 16 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.ActiveCfg = Debug|x64 17 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.Build.0 = Debug|x64 18 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.ActiveCfg = Release|Win32 19 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.Build.0 = Release|Win32 20 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.ActiveCfg = Release|x64 21 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.Build.0 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /RIOUDPTrafficGenerator/RIOUDPTrafficGenerator.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2012 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RIOUDPTrafficGenerator", "RIOUDPTrafficGenerator.vcxproj", "{325A75CE-D7FA-4FA9-91AA-91EDEA761635}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Debug|x64 = Debug|x64 10 | Release|Win32 = Release|Win32 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.Build.0 = Debug|Win32 16 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.ActiveCfg = Debug|x64 17 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.Build.0 = Debug|x64 18 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.ActiveCfg = Release|Win32 19 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.Build.0 = Release|Win32 20 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.ActiveCfg = Release|x64 21 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.Build.0 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /RIOIOCPUDPMTReaderThread/RIOIOCPUDPMTReaderThread.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 11 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RIOIOCPUDPMTReaderThread", "RIOIOCPUDPMTReaderThread.vcxproj", "{325A75CE-D7FA-4FA9-91AA-91EDEA761635}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Debug|x64 = Debug|x64 10 | Release|Win32 = Release|Win32 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.Build.0 = Debug|Win32 16 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.ActiveCfg = Debug|x64 17 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.Build.0 = Debug|x64 18 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.ActiveCfg = Release|Win32 19 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.Build.0 = Release|Win32 20 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.ActiveCfg = Release|x64 21 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.Build.0 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /SimpleUDPTrafficGenerator/SimpleUDPTrafficGenerator.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 11 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SimpleUDPTrafficGenerator", "SimpleUDPTrafficGenerator.vcxproj", "{325A75CE-D7FA-4FA9-91AA-91EDEA761635}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Debug|x64 = Debug|x64 10 | Release|Win32 = Release|Win32 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.Build.0 = Debug|Win32 16 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.ActiveCfg = Debug|x64 17 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.Build.0 = Debug|x64 18 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.ActiveCfg = Release|Win32 19 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.Build.0 = Release|Win32 20 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.ActiveCfg = Release|x64 21 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.Build.0 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /RunTests/RIOIOCPPolledUDPMT-Counters.txt: -------------------------------------------------------------------------------- 1 | "\Process(RIOIOCPPolledUDPMT)\% Privileged Time" 2 | "\Process(RIOIOCPPolledUDPMT)\% Processor Time" 3 | "\Process(RIOIOCPPolledUDPMT)\% User Time" 4 | "\Process(RIOIOCPPolledUDPMT)\IO Other Bytes/sec" 5 | "\Process(RIOIOCPPolledUDPMT)\IO Other Operations/sec" 6 | "\Process(RIOIOCPPolledUDPMT)\Pool Nonpaged Bytes" 7 | "\Process(RIOIOCPPolledUDPMT)\Working Set - Private" 8 | "\Thread(RIOIOCPPolledUDPMT/0)\Context Switches/sec" 9 | "\Thread(RIOIOCPPolledUDPMT/1)\Context Switches/sec" 10 | "\Thread(RIOIOCPPolledUDPMT/2)\Context Switches/sec" 11 | "\Thread(RIOIOCPPolledUDPMT/3)\Context Switches/sec" 12 | "\Thread(RIOIOCPPolledUDPMT/4)\Context Switches/sec" 13 | "\Thread(RIOIOCPPolledUDPMT/5)\Context Switches/sec" 14 | "\Thread(RIOIOCPPolledUDPMT/6)\Context Switches/sec" 15 | "\Thread(RIOIOCPPolledUDPMT/7)\Context Switches/sec" 16 | "\Thread(RIOIOCPPolledUDPMT/8)\Context Switches/sec" 17 | "\Thread(RIOIOCPPolledUDPMT/9)\Context Switches/sec" 18 | "\Thread(RIOIOCPPolledUDPMT/10)\Context Switches/sec" 19 | "\Processor(_Total)\% DPC Time" 20 | "\Processor(_Total)\% Interrupt Time" 21 | "\Processor(_Total)\% Privileged Time" 22 | "\Processor(_Total)\% Processor Time" 23 | "\Processor(_Total)\% User Time" 24 | "\Processor(_Total)\Interrupts/sec" 25 | "\UDPv4\Datagrams Received Errors" 26 | "\UDPv4\Datagrams Received/sec" 27 | "\Microsoft Winsock BSP\Dropped Datagrams/sec" 28 | -------------------------------------------------------------------------------- /RIOIOCPPolledUDPMTReaderThread/RIOIOCPPolledUDPMTReaderThread.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 11 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RIOIOCPPolledUDPMTReaderThread", "RIOIOCPPolledUDPMTReaderThread.vcxproj", "{325A75CE-D7FA-4FA9-91AA-91EDEA761635}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Debug|x64 = Debug|x64 10 | Release|Win32 = Release|Win32 11 | Release|x64 = Release|x64 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.ActiveCfg = Debug|Win32 15 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|Win32.Build.0 = Debug|Win32 16 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.ActiveCfg = Debug|x64 17 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Debug|x64.Build.0 = Debug|x64 18 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.ActiveCfg = Release|Win32 19 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|Win32.Build.0 = Release|Win32 20 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.ActiveCfg = Release|x64 21 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635}.Release|x64.Build.0 = Release|x64 22 | EndGlobalSection 23 | GlobalSection(SolutionProperties) = preSolution 24 | HideSolutionNode = FALSE 25 | EndGlobalSection 26 | EndGlobal 27 | -------------------------------------------------------------------------------- /RIOUDPTrafficGenerator/RIOUDPTrafficGenerator.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | 26 | 27 | Source Files 28 | 29 | 30 | Source Files 31 | 32 | 33 | -------------------------------------------------------------------------------- /RunTests/RIOIOCPUDPMTReaderThread-Counters.txt: -------------------------------------------------------------------------------- 1 | "\Process(RIOIOCPUDPMTReaderThread)\% Privileged Time" 2 | "\Process(RIOIOCPUDPMTReaderThread)\% Processor Time" 3 | "\Process(RIOIOCPUDPMTReaderThread)\% User Time" 4 | "\Process(RIOIOCPUDPMTReaderThread)\IO Other Bytes/sec" 5 | "\Process(RIOIOCPUDPMTReaderThread)\IO Other Operations/sec" 6 | "\Process(RIOIOCPUDPMTReaderThread)\Pool Nonpaged Bytes" 7 | "\Process(RIOIOCPUDPMTReaderThread)\Working Set - Private" 8 | "\Thread(RIOIOCPUDPMTReaderThread/0)\Context Switches/sec" 9 | "\Thread(RIOIOCPUDPMTReaderThread/1)\Context Switches/sec" 10 | "\Thread(RIOIOCPUDPMTReaderThread/2)\Context Switches/sec" 11 | "\Thread(RIOIOCPUDPMTReaderThread/3)\Context Switches/sec" 12 | "\Thread(RIOIOCPUDPMTReaderThread/4)\Context Switches/sec" 13 | "\Thread(RIOIOCPUDPMTReaderThread/5)\Context Switches/sec" 14 | "\Thread(RIOIOCPUDPMTReaderThread/6)\Context Switches/sec" 15 | "\Thread(RIOIOCPUDPMTReaderThread/7)\Context Switches/sec" 16 | "\Thread(RIOIOCPUDPMTReaderThread/8)\Context Switches/sec" 17 | "\Thread(RIOIOCPUDPMTReaderThread/9)\Context Switches/sec" 18 | "\Thread(RIOIOCPUDPMTReaderThread/10)\Context Switches/sec" 19 | "\Processor(_Total)\% DPC Time" 20 | "\Processor(_Total)\% Interrupt Time" 21 | "\Processor(_Total)\% Privileged Time" 22 | "\Processor(_Total)\% Processor Time" 23 | "\Processor(_Total)\% User Time" 24 | "\Processor(_Total)\Interrupts/sec" 25 | "\UDPv4\Datagrams Received Errors" 26 | "\UDPv4\Datagrams Received/sec" 27 | "\Microsoft Winsock BSP\Dropped Datagrams/sec" 28 | -------------------------------------------------------------------------------- /RunTests/RIOIOCPUDPPolledMTReaderThread-Counters.txt: -------------------------------------------------------------------------------- 1 | "\Process(RIOIOCPUDPMTReaderThread)\% Privileged Time" 2 | "\Process(RIOIOCPUDPMTReaderThread)\% Processor Time" 3 | "\Process(RIOIOCPUDPMTReaderThread)\% User Time" 4 | "\Process(RIOIOCPUDPMTReaderThread)\IO Other Bytes/sec" 5 | "\Process(RIOIOCPUDPMTReaderThread)\IO Other Operations/sec" 6 | "\Process(RIOIOCPUDPMTReaderThread)\Pool Nonpaged Bytes" 7 | "\Process(RIOIOCPUDPMTReaderThread)\Working Set - Private" 8 | "\Thread(RIOIOCPUDPMTReaderThread/0)\Context Switches/sec" 9 | "\Thread(RIOIOCPUDPMTReaderThread/1)\Context Switches/sec" 10 | "\Thread(RIOIOCPUDPMTReaderThread/2)\Context Switches/sec" 11 | "\Thread(RIOIOCPUDPMTReaderThread/3)\Context Switches/sec" 12 | "\Thread(RIOIOCPUDPMTReaderThread/4)\Context Switches/sec" 13 | "\Thread(RIOIOCPUDPMTReaderThread/5)\Context Switches/sec" 14 | "\Thread(RIOIOCPUDPMTReaderThread/6)\Context Switches/sec" 15 | "\Thread(RIOIOCPUDPMTReaderThread/7)\Context Switches/sec" 16 | "\Thread(RIOIOCPUDPMTReaderThread/8)\Context Switches/sec" 17 | "\Thread(RIOIOCPUDPMTReaderThread/9)\Context Switches/sec" 18 | "\Thread(RIOIOCPUDPMTReaderThread/10)\Context Switches/sec" 19 | "\Processor(_Total)\% DPC Time" 20 | "\Processor(_Total)\% Interrupt Time" 21 | "\Processor(_Total)\% Privileged Time" 22 | "\Processor(_Total)\% Processor Time" 23 | "\Processor(_Total)\% User Time" 24 | "\Processor(_Total)\Interrupts/sec" 25 | "\UDPv4\Datagrams Received Errors" 26 | "\UDPv4\Datagrams Received/sec" 27 | "\Microsoft Winsock BSP\Dropped Datagrams/sec" 28 | -------------------------------------------------------------------------------- /IOCPUDP/IOCPUDP.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | -------------------------------------------------------------------------------- /IOCPUDPMT/IOCPUDPMT.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | -------------------------------------------------------------------------------- /RIOIOCPUDP/RIOIOCPUDP.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | -------------------------------------------------------------------------------- /RIOIOCPUDPMT/RIOIOCPUDPMT.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | -------------------------------------------------------------------------------- /RIOPolledUDP/RIOPolledUDP.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | -------------------------------------------------------------------------------- /RunTests/RIOIOCPPolledUDPMTReaderThread-Counters.txt: -------------------------------------------------------------------------------- 1 | "\Process(RIOIOCPPolledUDPMTReaderThread)\% Privileged Time" 2 | "\Process(RIOIOCPPolledUDPMTReaderThread)\% Processor Time" 3 | "\Process(RIOIOCPPolledUDPMTReaderThread)\% User Time" 4 | "\Process(RIOIOCPPolledUDPMTReaderThread)\IO Other Bytes/sec" 5 | "\Process(RIOIOCPPolledUDPMTReaderThread)\IO Other Operations/sec" 6 | "\Process(RIOIOCPPolledUDPMTReaderThread)\Pool Nonpaged Bytes" 7 | "\Process(RIOIOCPPolledUDPMTReaderThread)\Working Set - Private" 8 | "\Thread(RIOIOCPPolledUDPMTReaderThread/0)\Context Switches/sec" 9 | "\Thread(RIOIOCPPolledUDPMTReaderThread/1)\Context Switches/sec" 10 | "\Thread(RIOIOCPPolledUDPMTReaderThread/2)\Context Switches/sec" 11 | "\Thread(RIOIOCPPolledUDPMTReaderThread/3)\Context Switches/sec" 12 | "\Thread(RIOIOCPPolledUDPMTReaderThread/4)\Context Switches/sec" 13 | "\Thread(RIOIOCPPolledUDPMTReaderThread/5)\Context Switches/sec" 14 | "\Thread(RIOIOCPPolledUDPMTReaderThread/6)\Context Switches/sec" 15 | "\Thread(RIOIOCPPolledUDPMTReaderThread/7)\Context Switches/sec" 16 | "\Thread(RIOIOCPPolledUDPMTReaderThread/8)\Context Switches/sec" 17 | "\Thread(RIOIOCPPolledUDPMTReaderThread/9)\Context Switches/sec" 18 | "\Thread(RIOIOCPPolledUDPMTReaderThread/10)\Context Switches/sec" 19 | "\Processor(_Total)\% DPC Time" 20 | "\Processor(_Total)\% Interrupt Time" 21 | "\Processor(_Total)\% Privileged Time" 22 | "\Processor(_Total)\% Processor Time" 23 | "\Processor(_Total)\% User Time" 24 | "\Processor(_Total)\Interrupts/sec" 25 | "\UDPv4\Datagrams Received Errors" 26 | "\UDPv4\Datagrams Received/sec" 27 | "\Microsoft Winsock BSP\Dropped Datagrams/sec" 28 | -------------------------------------------------------------------------------- /IOCPUDPMTGQCSEx/IOCPUDPMTGQCSEx.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | -------------------------------------------------------------------------------- /SimplePolledUDP/SimplePolledUDP.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | -------------------------------------------------------------------------------- /RIOEventDrivenUDP/RIOEventDrivenUDP.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | -------------------------------------------------------------------------------- /RIOIOCPPolledUDPMT/RIOIOCPPolledUDPMT.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | -------------------------------------------------------------------------------- /RIOEventDrivenPolledUDP/RIOEventDrivenPolledUDP.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | -------------------------------------------------------------------------------- /RIOIOCPUDPMTReaderThread/RIOIOCPUDPMTReaderThread.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | -------------------------------------------------------------------------------- /SimpleUDPTrafficGenerator/SimpleUDPTrafficGenerator.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | -------------------------------------------------------------------------------- /RIOIOCPPolledUDPMTReaderThread/RIOIOCPPolledUDPMTReaderThread.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | 32 | 33 | Source Files 34 | 35 | 36 | Source Files 37 | 38 | 39 | -------------------------------------------------------------------------------- /SimplePolledUDP/SimplePolledUDP.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #include "..\Shared\Constants.h" 4 | #include "..\Shared\Shared.h" 5 | 6 | int _tmain(int argc, _TCHAR* argv[]) 7 | { 8 | if (argc > 2) 9 | { 10 | cout << "Usage: SimplePolledUDP [workLoad]" << endl; 11 | } 12 | 13 | if (argc > 1) 14 | { 15 | g_workIterations = _ttol(argv[1]); 16 | } 17 | 18 | SetupTiming("Simple polled UDP"); 19 | 20 | InitialiseWinsock(); 21 | 22 | SOCKET s = CreateSocket(); 23 | 24 | Bind(s, PORT); 25 | 26 | SetSocketRecvBufferToMaximum(s); 27 | 28 | bool done = false; 29 | 30 | CHAR buffer[RECV_BUFFER_SIZE]; 31 | 32 | WSABUF buf; 33 | 34 | buf.buf = buffer; 35 | buf.len = RECV_BUFFER_SIZE; 36 | 37 | DWORD bytesRecvd = 0; 38 | 39 | DWORD flags = 0; 40 | 41 | if (SOCKET_ERROR == ::WSARecv( 42 | s, 43 | &buf, 44 | 1, 45 | &bytesRecvd, 46 | &flags, 47 | 0, 48 | 0)) 49 | { 50 | ErrorExit("WSARecv"); 51 | } 52 | 53 | g_packets++; 54 | 55 | StartTiming(); 56 | 57 | int workValue = 0; 58 | 59 | do 60 | { 61 | workValue += DoWork(g_workIterations); 62 | 63 | if (SOCKET_ERROR == ::WSARecv( 64 | s, 65 | &buf, 66 | 1, 67 | &bytesRecvd, 68 | &flags, 69 | 0, 70 | 0)) 71 | { 72 | ErrorExit("WSARecv"); 73 | } 74 | 75 | if (bytesRecvd == EXPECTED_DATA_SIZE) 76 | { 77 | g_packets++; 78 | } 79 | else 80 | { 81 | done = true; 82 | } 83 | } 84 | while (!done); 85 | 86 | StopTiming(); 87 | 88 | PrintTimings(); 89 | 90 | return workValue; 91 | } 92 | 93 | -------------------------------------------------------------------------------- /RIOTest/RIOTest/RIOTest.vcxproj.filters: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | 35 | 36 | Source Files 37 | 38 | 39 | Source Files 40 | 41 | 42 | Source Files 43 | 44 | 45 | Source Files 46 | 47 | 48 | -------------------------------------------------------------------------------- /IOCPUDP/IOCPUDP.cpp: -------------------------------------------------------------------------------- 1 | // RIOTest.cpp : Defines the entry point for the console application. 2 | // 3 | 4 | #include "stdafx.h" 5 | 6 | #include "..\Shared\Constants.h" 7 | #include "..\Shared\Shared.h" 8 | 9 | int _tmain(int argc, _TCHAR* argv[]) 10 | { 11 | if (argc > 2) 12 | { 13 | cout << "Usage: IOCPUDP [workLoad]" << endl; 14 | } 15 | 16 | if (argc > 1) 17 | { 18 | g_workIterations = _ttol(argv[1]); 19 | } 20 | 21 | SetupTiming("IOCP UDP"); 22 | 23 | InitialiseWinsock(); 24 | 25 | SOCKET s = CreateSocket(WSA_FLAG_OVERLAPPED); 26 | 27 | HANDLE hIOCP = CreateIOCP(); 28 | 29 | if (0 == ::CreateIoCompletionPort(reinterpret_cast(s), hIOCP, 0, 0)) 30 | { 31 | ErrorExit("CreateIoCompletionPort"); 32 | } 33 | 34 | Bind(s, PORT); 35 | 36 | PostIOCPRecvs(RECV_BUFFER_SIZE, IOCP_PENDING_RECVS); 37 | 38 | bool done = false; 39 | 40 | DWORD numberOfBytes = 0; 41 | 42 | ULONG_PTR completionKey = 0; 43 | 44 | OVERLAPPED *pOverlapped = 0; 45 | 46 | if (!::GetQueuedCompletionStatus(hIOCP, &numberOfBytes, &completionKey, &pOverlapped, INFINITE)) 47 | { 48 | ErrorExit("GetQueuedCompletionStatus"); 49 | } 50 | 51 | StartTiming(); 52 | 53 | DWORD bytesRecvd = 0; 54 | DWORD flags = 0; 55 | 56 | do 57 | { 58 | if (numberOfBytes == EXPECTED_DATA_SIZE) 59 | { 60 | g_packets++; 61 | 62 | EXTENDED_OVERLAPPED *pExtOverlapped = static_cast(pOverlapped); 63 | 64 | if (SOCKET_ERROR == ::WSARecv(g_s, &(pExtOverlapped->buf), 1, &bytesRecvd, &flags, pExtOverlapped, 0)) 65 | { 66 | const DWORD lastError = ::GetLastError(); 67 | 68 | if (lastError != ERROR_IO_PENDING) 69 | { 70 | ErrorExit("WSARecv", lastError); 71 | } 72 | } 73 | } 74 | else 75 | { 76 | StopTiming(); 77 | 78 | done = true; 79 | } 80 | 81 | if (!done) 82 | { 83 | if (!::GetQueuedCompletionStatus(hIOCP, &numberOfBytes, &completionKey, &pOverlapped, INFINITE)) 84 | { 85 | ErrorExit("GetQueuedCompletionStatus"); 86 | } 87 | } 88 | } 89 | while (!done); 90 | 91 | PrintTimings(); 92 | 93 | return 0; 94 | } 95 | 96 | -------------------------------------------------------------------------------- /SimpleUDPTrafficGenerator/SimpleUDPTrafficGenerator.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #include "..\Shared\Constants.h" 4 | #include "..\Shared\Shared.h" 5 | 6 | int main(int argc, char* argv[]) 7 | { 8 | if (argc < 2 || argc > 4) 9 | { 10 | cout << "Error: no remote address specified" << endl; 11 | cout << "Usage: SimpleUDPTrafficGeneraor [datagrams to send] [shutdown datagrams to send]" << endl; 12 | } 13 | 14 | long datagramsToSend = DATAGRAMS_TO_SEND; 15 | 16 | if (argc > 2) 17 | { 18 | datagramsToSend = atol(argv[2]); 19 | } 20 | 21 | long shutdownDatagramsToSend = SHUTDOWN_DATAGRAMS_TO_SEND; 22 | 23 | if (argc > 3) 24 | { 25 | shutdownDatagramsToSend = atol(argv[3]); 26 | } 27 | 28 | const char *pAddress = argv[1]; 29 | 30 | SetupTiming("Simple UDP Traffic generator", false); 31 | 32 | cout << "Send to: " << pAddress << " - " << PORT << endl; 33 | cout << "Datagrams to send: " << datagramsToSend << endl; 34 | cout << "Shutdown datagrams: " << shutdownDatagramsToSend << endl; 35 | 36 | 37 | InitialiseWinsock(); 38 | 39 | SOCKET s = CreateSocket(); 40 | 41 | SetSocketSendBufferToMaximum(s); 42 | 43 | sockaddr_in addr; 44 | 45 | addr.sin_family = AF_INET; 46 | addr.sin_port = htons(PORT); 47 | addr.sin_addr.s_addr = inet_addr(pAddress); 48 | 49 | bool done = false; 50 | 51 | CHAR buffer[SEND_BUFFER_SIZE]; 52 | 53 | WSABUF buf; 54 | 55 | buf.buf = buffer; 56 | buf.len = SEND_BUFFER_SIZE; 57 | 58 | DWORD bytesSent = 0; 59 | 60 | DWORD flags = 0; 61 | 62 | StartTiming(); 63 | 64 | for (long i = 0; i < datagramsToSend; ++i) 65 | { 66 | if (SOCKET_ERROR == ::WSASendTo( 67 | s, 68 | &buf, 69 | 1, 70 | &bytesSent, 71 | flags, 72 | reinterpret_cast(&addr), 73 | sizeof(addr), 74 | 0, 75 | 0)) 76 | { 77 | ErrorExit("WSASend"); 78 | } 79 | } 80 | 81 | StopTiming(); 82 | 83 | buf.len = SEND_BUFFER_SIZE / 2; 84 | 85 | for (long i = 0; i < shutdownDatagramsToSend; ++i) 86 | { 87 | if (SOCKET_ERROR == ::WSASendTo( 88 | s, 89 | &buf, 90 | 1, 91 | &bytesSent, 92 | flags, 93 | reinterpret_cast(&addr), 94 | sizeof(addr), 0, 0)) 95 | { 96 | ErrorExit("WSASend"); 97 | } 98 | Sleep(100); 99 | } 100 | 101 | g_packets = datagramsToSend; 102 | 103 | PrintTimings("Sent "); 104 | 105 | return 0; 106 | } 107 | 108 | -------------------------------------------------------------------------------- /RIOTest/RIOTest/UsesWinsock.cpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // File: UsesWinsock.cpp 3 | /////////////////////////////////////////////////////////////////////////////// 4 | // 5 | // Copyright 2002 JetByte Limited. 6 | // 7 | // This software is provided "as is" without a warranty of any kind. All 8 | // express or implied conditions, representations and warranties, including 9 | // any implied warranty of merchantability, fitness for a particular purpose 10 | // or non-infringement, are hereby excluded. JetByte Limited and its licensors 11 | // shall not be liable for any damages suffered by licensee as a result of 12 | // using the software. In no event will JetByte Limited be liable for any 13 | // lost revenue, profit or data, or for direct, indirect, special, 14 | // consequential, incidental or punitive damages, however caused and regardless 15 | // of the theory of liability, arising out of the use of or inability to use 16 | // software, even if JetByte Limited has been advised of the possibility of 17 | // such damages. 18 | // 19 | /////////////////////////////////////////////////////////////////////////////// 20 | 21 | //#include "JetByteTools\Admin\Admin.h" 22 | #include "stdafx.h" 23 | #include "UsesWinsock.h" 24 | 25 | //#include "JetByteTools\Win32Tools\Win32Exception.h" 26 | 27 | #pragma hdrstop 28 | 29 | /////////////////////////////////////////////////////////////////////////////// 30 | // Using directives 31 | /////////////////////////////////////////////////////////////////////////////// 32 | 33 | //using JetByteTools::Win32::CWin32Exception; 34 | 35 | /////////////////////////////////////////////////////////////////////////////// 36 | // Namespace: JetByteTools::Socket 37 | /////////////////////////////////////////////////////////////////////////////// 38 | 39 | namespace JetByteTools { 40 | namespace Socket { 41 | 42 | /////////////////////////////////////////////////////////////////////////////// 43 | // CUsesWinsock 44 | /////////////////////////////////////////////////////////////////////////////// 45 | 46 | CUsesWinsock::CUsesWinsock() 47 | { 48 | WORD wVersionRequested = 0x202; 49 | 50 | const DWORD result = ::WSAStartup(wVersionRequested, &m_data); 51 | 52 | if (0 != result) 53 | { 54 | "TODO";//throw CWin32Exception(_T("CUsesWinsock::CUsesWinsock()"), result); 55 | } 56 | } 57 | 58 | CUsesWinsock::~CUsesWinsock() 59 | { 60 | WSACleanup(); 61 | } 62 | 63 | /////////////////////////////////////////////////////////////////////////////// 64 | // Namespace: JetByteTools::Socket 65 | /////////////////////////////////////////////////////////////////////////////// 66 | 67 | } // End of namespace Socket 68 | } // End of namespace JetByteTools 69 | 70 | 71 | /////////////////////////////////////////////////////////////////////////////// 72 | // End of file: UsesWinsock.cpp 73 | /////////////////////////////////////////////////////////////////////////////// 74 | 75 | -------------------------------------------------------------------------------- /RIOTest/RIOTest/UsesWinsock.h: -------------------------------------------------------------------------------- 1 | #if defined (_MSC_VER) && (_MSC_VER >= 1020) 2 | #pragma once 3 | #endif 4 | 5 | #ifndef JETBYTE_TOOLS_SOCKET_USES_WINSOCK_INCLUDED__ 6 | #define JETBYTE_TOOLS_SOCKET_USES_WINSOCK_INCLUDED__ 7 | /////////////////////////////////////////////////////////////////////////////// 8 | // File: UsesWinsock.h 9 | /////////////////////////////////////////////////////////////////////////////// 10 | // 11 | // Copyright 2002 JetByte Limited. 12 | // 13 | // This software is provided "as is" without a warranty of any kind. All 14 | // express or implied conditions, representations and warranties, including 15 | // any implied warranty of merchantability, fitness for a particular purpose 16 | // or non-infringement, are hereby excluded. JetByte Limited and its licensors 17 | // shall not be liable for any damages suffered by licensee as a result of 18 | // using the software. In no event will JetByte Limited be liable for any 19 | // lost revenue, profit or data, or for direct, indirect, special, 20 | // consequential, incidental or punitive damages, however caused and regardless 21 | // of the theory of liability, arising out of the use of or inability to use 22 | // software, even if JetByte Limited has been advised of the possibility of 23 | // such damages. 24 | // 25 | /////////////////////////////////////////////////////////////////////////////// 26 | 27 | #include 28 | 29 | /////////////////////////////////////////////////////////////////////////////// 30 | // Namespace: JetByteTools::Socket 31 | /////////////////////////////////////////////////////////////////////////////// 32 | 33 | namespace JetByteTools { 34 | namespace Socket { 35 | 36 | /////////////////////////////////////////////////////////////////////////////// 37 | // CUsesWinsock 38 | /////////////////////////////////////////////////////////////////////////////// 39 | 40 | /// A simple object to support \ref RAII "scope based" Winsock initialisation 41 | /// and uninitialisation. Create an instance of this at the scope where you want 42 | /// Winsock to be available and it will be automatically uninitialised when the 43 | /// scope ends. 44 | /// \ingroup SocketUtils 45 | /// \ingroup RAII 46 | 47 | class CUsesWinsock 48 | { 49 | public : 50 | 51 | /// Note that we don't currently allow you to select the version of 52 | /// Winsock that you require... 53 | 54 | CUsesWinsock(); 55 | 56 | ~CUsesWinsock(); 57 | 58 | private : 59 | 60 | WSADATA m_data; 61 | 62 | /// No copies do not implement 63 | CUsesWinsock(const CUsesWinsock &rhs); 64 | /// No copies do not implement 65 | CUsesWinsock &operator=(const CUsesWinsock &rhs); 66 | }; 67 | 68 | /////////////////////////////////////////////////////////////////////////////// 69 | // Namespace: JetByteTools::Socket 70 | /////////////////////////////////////////////////////////////////////////////// 71 | 72 | } // End of namespace Socket 73 | } // End of namespace JetByteTools 74 | 75 | #endif // JETBYTE_TOOLS_SOCKET_USES_WINSOCK_INCLUDED__ 76 | 77 | /////////////////////////////////////////////////////////////////////////////// 78 | // End of file: UsesWinsock.h 79 | /////////////////////////////////////////////////////////////////////////////// 80 | 81 | -------------------------------------------------------------------------------- /RIOPolledUDP/RIOPolledUDP.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #include "..\Shared\Constants.h" 4 | #include "..\Shared\Shared.h" 5 | 6 | int _tmain(int argc, _TCHAR* argv[]) 7 | { 8 | if (argc > 2) 9 | { 10 | cout << "Usage: RIOPolledUDP [workLoad]" << endl; 11 | } 12 | 13 | if (argc > 1) 14 | { 15 | g_workIterations = _ttol(argv[1]); 16 | } 17 | 18 | SetupTiming("RIO polled UDP"); 19 | 20 | InitialiseWinsock(); 21 | 22 | CreateRIOSocket(); 23 | 24 | g_queue = g_rio.RIOCreateCompletionQueue(RIO_PENDING_RECVS, 0); 25 | 26 | if (g_queue == RIO_INVALID_CQ) 27 | { 28 | ErrorExit("RIOCreateCompletionQueue"); 29 | } 30 | 31 | ULONG maxOutstandingReceive = RIO_PENDING_RECVS; 32 | ULONG maxReceiveDataBuffers = 1; 33 | ULONG maxOutstandingSend = 0; 34 | ULONG maxSendDataBuffers = 1; 35 | 36 | void *pContext = 0; 37 | 38 | g_requestQueue = g_rio.RIOCreateRequestQueue( 39 | g_s, 40 | maxOutstandingReceive, 41 | maxReceiveDataBuffers, 42 | maxOutstandingSend, 43 | maxSendDataBuffers, 44 | g_queue, 45 | g_queue, 46 | pContext); 47 | 48 | if (g_requestQueue == RIO_INVALID_RQ) 49 | { 50 | ErrorExit("RIOCreateRequestQueue"); 51 | } 52 | 53 | PostRIORecvs(RECV_BUFFER_SIZE, RIO_PENDING_RECVS); 54 | 55 | bool done = false; 56 | 57 | DWORD recvFlags = 0; 58 | 59 | RIORESULT results[RIO_MAX_RESULTS]; 60 | 61 | ULONG numResults = 0; 62 | 63 | do 64 | { 65 | numResults = g_rio.RIODequeueCompletion( 66 | g_queue, 67 | results, 68 | RIO_MAX_RESULTS); 69 | 70 | if (0 == numResults) 71 | { 72 | YieldProcessor(); 73 | } 74 | else if (RIO_CORRUPT_CQ == numResults) 75 | { 76 | ErrorExit("RIODequeueCompletion"); 77 | } 78 | } 79 | while (0 == numResults); 80 | 81 | StartTiming(); 82 | 83 | int workValue = 0; 84 | 85 | bool running = true; 86 | 87 | do 88 | { 89 | for (DWORD i = 0; i < numResults; ++i) 90 | { 91 | EXTENDED_RIO_BUF *pBuffer = reinterpret_cast(results[i].RequestContext); 92 | 93 | if (results[i].BytesTransferred == EXPECTED_DATA_SIZE) 94 | { 95 | g_packets++; 96 | 97 | workValue += DoWork(g_workIterations); 98 | 99 | if (!g_rio.RIOReceive( 100 | g_requestQueue, 101 | pBuffer, 102 | 1, 103 | recvFlags, 104 | pBuffer)) 105 | { 106 | ErrorExit("RIOReceive"); 107 | } 108 | 109 | done = false; 110 | } 111 | else 112 | { 113 | done = true; 114 | } 115 | } 116 | 117 | if (!done) 118 | { 119 | do 120 | { 121 | numResults = g_rio.RIODequeueCompletion( 122 | g_queue, 123 | results, 124 | RIO_MAX_RESULTS); 125 | 126 | if (0 == numResults) 127 | { 128 | YieldProcessor(); 129 | } 130 | else if (RIO_CORRUPT_CQ == numResults) 131 | { 132 | ErrorExit("RIODequeueCompletion"); 133 | } 134 | } 135 | while (0 == numResults); 136 | } 137 | } 138 | while (!done); 139 | 140 | StopTiming(); 141 | 142 | PrintTimings(); 143 | 144 | return workValue; 145 | } 146 | 147 | -------------------------------------------------------------------------------- /IOCPUDPMT/IOCPUDPMT.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #include "..\Shared\Constants.h" 4 | #include "..\Shared\Shared.h" 5 | 6 | int _tmain(int argc, _TCHAR* argv[]) 7 | { 8 | if (argc > 2) 9 | { 10 | cout << "Usage: IOCPUDPMT [workLoad]" << endl; 11 | } 12 | 13 | if (argc > 1) 14 | { 15 | g_workIterations = _ttol(argv[1]); 16 | } 17 | 18 | SetupTiming("IOCP UDP MT"); 19 | 20 | InitialiseWinsock(); 21 | 22 | SOCKET s = CreateSocket(WSA_FLAG_OVERLAPPED); 23 | 24 | HANDLE hIOCP = CreateIOCP(); 25 | 26 | if (0 == ::CreateIoCompletionPort(reinterpret_cast(s), hIOCP, 1, 0)) 27 | { 28 | ErrorExit("CreateIoCompletionPort"); 29 | } 30 | 31 | Bind(s, PORT); 32 | 33 | PostIOCPRecvs(RECV_BUFFER_SIZE, IOCP_PENDING_RECVS); 34 | 35 | CreateIOCPThreads(NUM_IOCP_THREADS); 36 | 37 | WaitForProcessingStarted(); 38 | 39 | WaitForProcessingStopped(); 40 | 41 | StopIOCPThreads(); 42 | 43 | PrintTimings(); 44 | } 45 | 46 | unsigned int __stdcall ThreadFunction( 47 | void *pV) 48 | { 49 | #ifdef TRACK_THREAD_STATS 50 | const DWORD index = (DWORD)(ULONG_PTR)pV; 51 | 52 | ThreadData &threadData = g_threadData[index]; 53 | 54 | threadData.threadId = ::GetCurrentThreadId(); 55 | 56 | threadData.maxPacketsProcessed = 1; 57 | threadData.minPacketsProcessed = 1; 58 | #endif 59 | 60 | DWORD numberOfBytes = 0; 61 | 62 | ULONG_PTR completionKey = 0; 63 | 64 | OVERLAPPED *pOverlapped = 0; 65 | 66 | if (!::GetQueuedCompletionStatus(g_hIOCP, &numberOfBytes, &completionKey, &pOverlapped, INFINITE)) 67 | { 68 | ErrorExit("GetQueuedCompletionStatus"); 69 | } 70 | 71 | int workValue = 0; 72 | 73 | if (completionKey == 1) 74 | { 75 | bool done = false; 76 | 77 | ::SetEvent(g_hStartedEvent); 78 | 79 | DWORD bytesRecvd = 0; 80 | DWORD flags = 0; 81 | 82 | do 83 | { 84 | #ifdef TRACK_THREAD_STATS 85 | threadData.dequeueCalled++; 86 | 87 | threadData.packetsProcessed++; 88 | #endif 89 | 90 | if (numberOfBytes == EXPECTED_DATA_SIZE) 91 | { 92 | ::InterlockedIncrement(&g_packets); 93 | 94 | workValue += DoWork(g_workIterations); 95 | 96 | EXTENDED_OVERLAPPED *pExtOverlapped = static_cast(pOverlapped); 97 | 98 | if (SOCKET_ERROR == ::WSARecv(g_s, &(pExtOverlapped->buf), 1, &bytesRecvd, &flags, pExtOverlapped, 0)) 99 | { 100 | const DWORD lastError = ::GetLastError(); 101 | 102 | if (lastError != ERROR_IO_PENDING) 103 | { 104 | ErrorExit("WSARecv", lastError); 105 | } 106 | } 107 | 108 | done = false; 109 | 110 | } 111 | else 112 | { 113 | done = true; 114 | } 115 | 116 | if (!done) 117 | { 118 | if (!::GetQueuedCompletionStatus(g_hIOCP, &numberOfBytes, &completionKey, &pOverlapped, INFINITE)) 119 | { 120 | const DWORD lastError = ::GetLastError(); 121 | 122 | if (lastError != ERROR_OPERATION_ABORTED) 123 | { 124 | ErrorExit("GetQueuedCompletionStatus", lastError); 125 | } 126 | } 127 | 128 | if (completionKey == 0) 129 | { 130 | done = true; 131 | } 132 | } 133 | } 134 | while (!done); 135 | } 136 | 137 | ::SetEvent(g_hStoppedEvent); 138 | 139 | return workValue; 140 | } 141 | 142 | -------------------------------------------------------------------------------- /RIOIOCPUDP/RIOIOCPUDP.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #include "..\Shared\Constants.h" 4 | #include "..\Shared\Shared.h" 5 | 6 | int _tmain(int argc, _TCHAR* argv[]) 7 | { 8 | SetupTiming("RIO IOCP UDP"); 9 | 10 | InitialiseWinsock(); 11 | 12 | CreateRIOSocket(); 13 | 14 | g_hIOCP = ::CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, 0); 15 | 16 | OVERLAPPED overlapped; 17 | 18 | RIO_NOTIFICATION_COMPLETION completionType; 19 | 20 | completionType.Type = RIO_IOCP_COMPLETION; 21 | completionType.Iocp.IocpHandle = g_hIOCP; 22 | completionType.Iocp.CompletionKey = (void*)0; 23 | completionType.Iocp.Overlapped = &overlapped; 24 | 25 | g_queue = g_rio.RIOCreateCompletionQueue(RIO_PENDING_RECVS, &completionType); 26 | 27 | if (g_queue == RIO_INVALID_CQ) 28 | { 29 | ErrorExit("RIOCreateCompletionQueue"); 30 | } 31 | 32 | ULONG maxOutstandingReceive = RIO_PENDING_RECVS; 33 | ULONG maxReceiveDataBuffers = 1; 34 | ULONG maxOutstandingSend = 0; 35 | ULONG maxSendDataBuffers = 1; 36 | 37 | void *pContext = 0; 38 | 39 | g_requestQueue = g_rio.RIOCreateRequestQueue(g_s, maxOutstandingReceive, maxReceiveDataBuffers, maxOutstandingSend, maxSendDataBuffers, g_queue, g_queue, pContext); 40 | 41 | if (g_requestQueue == RIO_INVALID_RQ) 42 | { 43 | ErrorExit("RIOCreateRequestQueue"); 44 | } 45 | 46 | PostRIORecvs(RECV_BUFFER_SIZE, RIO_PENDING_RECVS); 47 | 48 | bool done = false; 49 | 50 | RIORESULT results[RIO_MAX_RESULTS]; 51 | 52 | INT notifyResult = g_rio.RIONotify(g_queue); 53 | 54 | if (notifyResult != ERROR_SUCCESS) 55 | { 56 | ErrorExit("RIONotify", notifyResult); 57 | } 58 | 59 | DWORD numberOfBytes = 0; 60 | 61 | ULONG_PTR completionKey = 0; 62 | 63 | OVERLAPPED *pOverlapped = 0; 64 | 65 | if (!::GetQueuedCompletionStatus(g_hIOCP, &numberOfBytes, &completionKey, &pOverlapped, INFINITE)) 66 | { 67 | ErrorExit("GetQueuedCompletionStatus"); 68 | } 69 | 70 | ULONG numResults = g_rio.RIODequeueCompletion(g_queue, results, RIO_MAX_RESULTS); 71 | 72 | if (0 == numResults || RIO_CORRUPT_CQ == numResults) 73 | { 74 | ErrorExit("RIODequeueCompletion"); 75 | } 76 | 77 | StartTiming(); 78 | 79 | DWORD recvFlags = 0; 80 | 81 | int workValue = 0; 82 | 83 | do 84 | { 85 | for (DWORD i = 0; i < numResults; ++i) 86 | { 87 | EXTENDED_RIO_BUF *pBuffer = reinterpret_cast(results[i].RequestContext); 88 | 89 | if (results[i].BytesTransferred == EXPECTED_DATA_SIZE) 90 | { 91 | g_packets++; 92 | 93 | workValue += DoWork(g_workIterations); 94 | 95 | if (!g_rio.RIOReceive(g_requestQueue, pBuffer, 1, recvFlags, pBuffer)) 96 | { 97 | ErrorExit("RIOReceive"); 98 | } 99 | 100 | done = false; 101 | } 102 | else 103 | { 104 | done = true; 105 | } 106 | } 107 | 108 | if (!done) 109 | { 110 | const INT notifyResult = g_rio.RIONotify(g_queue); 111 | 112 | if (notifyResult != ERROR_SUCCESS) 113 | { 114 | ErrorExit("RIONotify"); 115 | } 116 | 117 | if (!::GetQueuedCompletionStatus(g_hIOCP, &numberOfBytes, &completionKey, &pOverlapped, INFINITE)) 118 | { 119 | ErrorExit("GetQueuedCompletionStatus"); 120 | } 121 | 122 | numResults = g_rio.RIODequeueCompletion(g_queue, results, RIO_MAX_RESULTS); 123 | 124 | if (0 == numResults || RIO_CORRUPT_CQ == numResults) 125 | { 126 | ErrorExit("RIODequeueCompletion"); 127 | } 128 | } 129 | } 130 | while (!done); 131 | 132 | StopTiming(); 133 | 134 | PrintTimings(); 135 | 136 | return workValue; 137 | } 138 | 139 | -------------------------------------------------------------------------------- /IOCPUDPMTGQCSEx/IOCPUDPMTGQCSEx.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #define THREAD_STATS_SHOW_DEQUE 4 | #define THREAD_STATS_SHOW_MIN_MAX 5 | 6 | #include "..\Shared\Constants.h" 7 | #include "..\Shared\Shared.h" 8 | 9 | int _tmain(int argc, _TCHAR* argv[]) 10 | { 11 | if (argc > 2) 12 | { 13 | cout << "Usage: IOCPUDPMTGQCSEx [workLoad]" << endl; 14 | } 15 | 16 | if (argc > 1) 17 | { 18 | g_workIterations = _ttol(argv[1]); 19 | } 20 | 21 | SetupTiming("IOCP UDP MT GQCSEx"); 22 | 23 | InitialiseWinsock(); 24 | 25 | SOCKET s = CreateSocket(WSA_FLAG_OVERLAPPED); 26 | 27 | HANDLE hIOCP = CreateIOCP(); 28 | 29 | if (0 == ::CreateIoCompletionPort(reinterpret_cast(s), hIOCP, 1, 0)) 30 | { 31 | ErrorExit("CreateIoCompletionPort"); 32 | } 33 | 34 | Bind(s, PORT); 35 | 36 | PostIOCPRecvs(RECV_BUFFER_SIZE, IOCP_PENDING_RECVS); 37 | 38 | CreateIOCPThreads(NUM_IOCP_THREADS); 39 | 40 | WaitForProcessingStarted(); 41 | 42 | WaitForProcessingStopped(); 43 | 44 | StopIOCPThreads(); 45 | 46 | PrintTimings(); 47 | } 48 | 49 | unsigned int __stdcall ThreadFunction( 50 | void *pV) 51 | { 52 | #ifdef TRACK_THREAD_STATS 53 | const DWORD index = (DWORD)(ULONG_PTR)pV; 54 | 55 | ThreadData &threadData = g_threadData[index]; 56 | 57 | threadData.threadId = ::GetCurrentThreadId(); 58 | #endif 59 | 60 | DWORD numberOfBytes = 0; 61 | 62 | ULONG_PTR completionKey = 0; 63 | 64 | OVERLAPPED_ENTRY results[GQCSEX_MAX_RESULTS]; 65 | 66 | ULONG numResults = 0; 67 | 68 | if (!::GetQueuedCompletionStatusEx( 69 | g_hIOCP, 70 | results, 71 | GQCSEX_MAX_RESULTS, 72 | &numResults, 73 | INFINITE, 74 | FALSE)) 75 | { 76 | ErrorExit("GetQueuedCompletionStatusEx"); 77 | } 78 | 79 | ::SetEvent(g_hStartedEvent); 80 | 81 | int workValue = 0; 82 | 83 | bool running = true; 84 | 85 | bool done = false; 86 | 87 | do 88 | { 89 | #ifdef TRACK_THREAD_STATS 90 | threadData.dequeueCalled++; 91 | 92 | threadData.packetsProcessed += numResults; 93 | 94 | if (numResults > threadData.maxPacketsProcessed) 95 | { 96 | threadData.maxPacketsProcessed = numResults; 97 | } 98 | 99 | if (numResults < threadData.minPacketsProcessed) 100 | { 101 | threadData.minPacketsProcessed = numResults; 102 | } 103 | #endif 104 | 105 | for (DWORD i = 0; !done && i < numResults; ++i) 106 | { 107 | if (results[i].lpCompletionKey == 1) 108 | { 109 | if (results[i].dwNumberOfBytesTransferred == EXPECTED_DATA_SIZE) 110 | { 111 | ::InterlockedIncrement(&g_packets); 112 | 113 | workValue += DoWork(g_workIterations); 114 | 115 | EXTENDED_OVERLAPPED *pExtOverlapped = static_cast(results[i].lpOverlapped); 116 | 117 | DWORD bytesRecvd = 0; 118 | 119 | DWORD flags = 0; 120 | 121 | if (SOCKET_ERROR == ::WSARecv(g_s, &(pExtOverlapped->buf), 1, &bytesRecvd, &flags, pExtOverlapped, 0)) 122 | { 123 | const DWORD lastError = ::GetLastError(); 124 | 125 | if (lastError != ERROR_IO_PENDING) 126 | { 127 | ErrorExit("WSARecv", lastError); 128 | } 129 | } 130 | 131 | done = false; 132 | } 133 | else 134 | { 135 | done = true; 136 | } 137 | } 138 | else 139 | { 140 | done = true; 141 | } 142 | } 143 | 144 | if (!done) 145 | { 146 | numResults = 0; 147 | 148 | if (!::GetQueuedCompletionStatusEx( 149 | g_hIOCP, 150 | results, 151 | GQCSEX_MAX_RESULTS, 152 | &numResults, 153 | INFINITE, 154 | FALSE)) 155 | { 156 | ErrorExit("GetQueuedCompletionStatusEx"); 157 | } 158 | } 159 | } 160 | while (!done); 161 | 162 | ::SetEvent(g_hStoppedEvent); 163 | 164 | return workValue; 165 | } 166 | 167 | -------------------------------------------------------------------------------- /RIOTest/RIOTest/MSWinSock.h: -------------------------------------------------------------------------------- 1 | #if defined (_MSC_VER) && (_MSC_VER >= 1020) 2 | #pragma once 3 | #endif 4 | 5 | #ifndef JETBYTE_TOOLS_SOCKET_MS_WINSOCK_EXTENSIONS_INCLUDED__ 6 | #define JETBYTE_TOOLS_SOCKET_MS_WINSOCK_EXTENSIONS_INCLUDED__ 7 | /////////////////////////////////////////////////////////////////////////////// 8 | // File: MSWinSock.h 9 | /////////////////////////////////////////////////////////////////////////////// 10 | // 11 | // Copyright 2002 JetByte Limited. 12 | // 13 | // This software is provided "as is" without a warranty of any kind. All 14 | // express or implied conditions, representations and warranties, including 15 | // any implied warranty of merchantability, fitness for a particular purpose 16 | // or non-infringement, are hereby excluded. JetByte Limited and its licensors 17 | // shall not be liable for any damages suffered by licensee as a result of 18 | // using the software. In no event will JetByte Limited be liable for any 19 | // lost revenue, profit or data, or for direct, indirect, special, 20 | // consequential, incidental or punitive damages, however caused and regardless 21 | // of the theory of liability, arising out of the use of or inability to use 22 | // software, even if JetByte Limited has been advised of the possibility of 23 | // such damages. 24 | // 25 | /////////////////////////////////////////////////////////////////////////////// 26 | 27 | #include "UsesWinsock.h" 28 | 29 | // We have our own copy of mswsock.h so that we can compile with no platform SDK 30 | 31 | #include 32 | 33 | /////////////////////////////////////////////////////////////////////////////// 34 | // Namespace: JetByteTools::Socket 35 | /////////////////////////////////////////////////////////////////////////////// 36 | 37 | namespace JetByteTools { 38 | namespace Socket { 39 | 40 | /////////////////////////////////////////////////////////////////////////////// 41 | // CUsesMSWinSockExtensions 42 | /////////////////////////////////////////////////////////////////////////////// 43 | 44 | /// This class acts as a dynamic function loader for the MS Winsock extension 45 | /// functions via a WSAIoctl() call with SIO_GET_EXTENSION_FUNCTION_POINTER. 46 | /// The assumption is made that all sockets passed to this class will be from 47 | /// the same underlying provider (or, at the very least, all sockets passed 48 | /// to a particular extension function will be from the same provider). 49 | /// \ingroup SocketsUtils 50 | /// \ingroup RAII 51 | 52 | class CUsesMSWinSockExtensions : public CUsesWinsock 53 | { 54 | public: 55 | 56 | CUsesMSWinSockExtensions(); 57 | 58 | bool LoadRIOAPI( 59 | SOCKET s); 60 | 61 | bool RIOReceive( 62 | RIO_RQ SocketQueue, 63 | PRIO_BUF pData, 64 | ULONG DataBufferCount, 65 | DWORD Flags, 66 | PVOID RequestContext) const; 67 | 68 | bool RIOSend( 69 | RIO_RQ SocketQueue, 70 | PRIO_BUF pData, 71 | ULONG DataBufferCount, 72 | DWORD Flags, 73 | PVOID RequestContext) const; 74 | 75 | RIO_CQ RIOCreateCompletionQueue( 76 | DWORD QueueSize, 77 | PRIO_NOTIFICATION_COMPLETION NotificationCompletion) const; 78 | 79 | void RIOCloseCompletionQueue( 80 | RIO_CQ completionQueue) const; 81 | 82 | RIO_RQ RIOCreateRequestQueue( 83 | SOCKET Socket, 84 | ULONG MaxOutstandingReceive, 85 | ULONG MaxReceiveDataBuffers, 86 | ULONG MaxOutstandingSend, 87 | ULONG MaxSendDataBuffers, 88 | RIO_CQ ReceiveCQ, 89 | RIO_CQ SendCQ, 90 | PVOID SocketContext) const; 91 | 92 | RIO_BUFFERID RIORegisterBuffer( 93 | PCHAR DataBuffer, 94 | DWORD DataLength); 95 | 96 | void RIODeregisterBuffer( 97 | RIO_BUFFERID id); 98 | 99 | 100 | private : 101 | 102 | mutable RIO_EXTENSION_FUNCTION_TABLE *m_pRIOAPI; 103 | 104 | /// No copies do not implement 105 | CUsesMSWinSockExtensions(const CUsesMSWinSockExtensions &rhs); 106 | /// No copies do not implement 107 | CUsesMSWinSockExtensions &operator=(const CUsesMSWinSockExtensions &rhs); 108 | }; 109 | 110 | /////////////////////////////////////////////////////////////////////////////// 111 | // Namespace: JetByteTools::Socket 112 | /////////////////////////////////////////////////////////////////////////////// 113 | 114 | } // End of namespace Socket 115 | } // End of namespace JetByteTools 116 | 117 | #endif // JETBYTE_TOOLS_SOCKET_MS_WINSOCK_EXTENSIONS_INCLUDED__ 118 | 119 | /////////////////////////////////////////////////////////////////////////////// 120 | // End of file: MSWinSock.h 121 | /////////////////////////////////////////////////////////////////////////////// 122 | 123 | -------------------------------------------------------------------------------- /RIOEventDrivenUDP/RIOEventDrivenUDP.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #include "..\Shared\Constants.h" 4 | #include "..\Shared\Shared.h" 5 | 6 | int _tmain(int argc, _TCHAR* argv[]) 7 | { 8 | if (argc > 2) 9 | { 10 | cout << "Usage: RIOEventDrivenUDP [workLoad]" << endl; 11 | } 12 | 13 | if (argc > 1) 14 | { 15 | g_workIterations = _ttol(argv[1]); 16 | } 17 | 18 | SetupTiming("RIO Event Driven UDP"); 19 | 20 | InitialiseWinsock(); 21 | 22 | CreateRIOSocket(); 23 | 24 | HANDLE hEvent = WSACreateEvent(); 25 | 26 | if (hEvent == WSA_INVALID_EVENT) 27 | { 28 | ErrorExit("WSACreateEvent"); 29 | } 30 | 31 | RIO_NOTIFICATION_COMPLETION completionType; 32 | 33 | completionType.Type = RIO_EVENT_COMPLETION; 34 | completionType.Event.EventHandle = hEvent; 35 | #ifdef WE_RESET_EVENT 36 | completionType.Event.NotifyReset = FALSE; 37 | #else 38 | completionType.Event.NotifyReset = TRUE; 39 | #endif 40 | 41 | g_queue = g_rio.RIOCreateCompletionQueue(RIO_PENDING_RECVS, &completionType); 42 | 43 | if (g_queue == RIO_INVALID_CQ) 44 | { 45 | ErrorExit("RIOCreateCompletionQueue"); 46 | } 47 | 48 | ULONG maxOutstandingReceive = RIO_PENDING_RECVS; 49 | ULONG maxReceiveDataBuffers = 1; 50 | ULONG maxOutstandingSend = 0; 51 | ULONG maxSendDataBuffers = 1; 52 | 53 | void *pContext = 0; 54 | 55 | g_requestQueue = g_rio.RIOCreateRequestQueue( 56 | g_s, 57 | maxOutstandingReceive, 58 | maxReceiveDataBuffers, 59 | maxOutstandingSend, 60 | maxSendDataBuffers, 61 | g_queue, 62 | g_queue, 63 | pContext); 64 | 65 | if (g_requestQueue == RIO_INVALID_RQ) 66 | { 67 | ErrorExit("RIOCreateRequestQueue"); 68 | } 69 | 70 | PostRIORecvs(RECV_BUFFER_SIZE, RIO_PENDING_RECVS); 71 | 72 | #ifdef TRACK_THREAD_STATS 73 | ThreadData &threadData = g_threadData[0]; 74 | 75 | threadData.threadId = ::GetCurrentThreadId(); 76 | #endif 77 | 78 | bool done = false; 79 | 80 | DWORD recvFlags = 0; 81 | 82 | RIORESULT results[RIO_MAX_RESULTS]; 83 | 84 | const INT notifyResult = g_rio.RIONotify(g_queue); 85 | 86 | if (notifyResult != ERROR_SUCCESS) 87 | { 88 | ErrorExit("RIONotify"); 89 | } 90 | 91 | const DWORD waitResult = WaitForSingleObject(hEvent, INFINITE); 92 | 93 | if (waitResult != WAIT_OBJECT_0) 94 | { 95 | ErrorExit("WaitForSingleObject"); 96 | } 97 | 98 | StartTiming(); 99 | 100 | ULONG numResults = g_rio.RIODequeueCompletion(g_queue, results, RIO_MAX_RESULTS); 101 | 102 | if (0 == numResults || RIO_CORRUPT_CQ == numResults) 103 | { 104 | ErrorExit("RIODequeueCompletion"); 105 | } 106 | 107 | int workValue = 0; 108 | 109 | bool running = true; 110 | 111 | do 112 | { 113 | #ifdef TRACK_THREAD_STATS 114 | threadData.dequeueCalled++; 115 | 116 | threadData.packetsProcessed += numResults; 117 | 118 | if (numResults > threadData.maxPacketsProcessed) 119 | { 120 | threadData.maxPacketsProcessed = numResults; 121 | } 122 | 123 | if (numResults < threadData.minPacketsProcessed) 124 | { 125 | threadData.minPacketsProcessed = numResults; 126 | } 127 | #endif 128 | 129 | for (DWORD i = 0; i < numResults; ++i) 130 | { 131 | EXTENDED_RIO_BUF *pBuffer = reinterpret_cast(results[i].RequestContext); 132 | 133 | if (results[i].BytesTransferred == EXPECTED_DATA_SIZE) 134 | { 135 | g_packets++; 136 | 137 | workValue += DoWork(g_workIterations); 138 | 139 | if (!g_rio.RIOReceive( 140 | g_requestQueue, 141 | pBuffer, 142 | 1, 143 | recvFlags, 144 | pBuffer)) 145 | { 146 | ErrorExit("RIOReceive"); 147 | } 148 | 149 | done = false; 150 | } 151 | else 152 | { 153 | done = true; 154 | } 155 | } 156 | 157 | if (!done) 158 | { 159 | #ifdef WE_RESET_EVENT 160 | if (!::ResetEvent(hEvent)) 161 | { 162 | ErrorExit("ResetEvent"); 163 | } 164 | #endif 165 | 166 | #ifdef TRACK_THREAD_STATS 167 | threadData.notifyCalled++; 168 | #endif 169 | 170 | const INT notifyResult = g_rio.RIONotify(g_queue); 171 | 172 | if (notifyResult != ERROR_SUCCESS) 173 | { 174 | ErrorExit("RIONotify"); 175 | } 176 | 177 | const DWORD waitResult = WaitForSingleObject(hEvent, INFINITE); 178 | 179 | if (waitResult != WAIT_OBJECT_0) 180 | { 181 | ErrorExit("WaitForSingleObject"); 182 | } 183 | 184 | numResults = g_rio.RIODequeueCompletion(g_queue, results, RIO_MAX_RESULTS); 185 | 186 | if (0 == numResults || RIO_CORRUPT_CQ == numResults) 187 | { 188 | ErrorExit("RIODequeueCompletion"); 189 | } 190 | } 191 | } 192 | while (!done); 193 | 194 | StopTiming(); 195 | 196 | PrintTimings(); 197 | 198 | DisplayThreadStats(); 199 | 200 | return workValue; 201 | } 202 | 203 | -------------------------------------------------------------------------------- /RIOTest/RIOTest/RIOTest.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | $(VCTargetsPath11) 15 | 16 | 17 | {15409D63-BEDE-4F97-A2E8-D190FEBEA70B} 18 | Win32Proj 19 | RIOTest 20 | 21 | 22 | 23 | Application 24 | true 25 | v143 26 | Unicode 27 | 28 | 29 | Application 30 | false 31 | v143 32 | true 33 | Unicode 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | true 47 | 48 | 49 | false 50 | 51 | 52 | 53 | Use 54 | Level3 55 | Disabled 56 | _WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 57 | 4312 58 | 59 | 60 | Console 61 | true 62 | 63 | 64 | 65 | 66 | Level3 67 | Use 68 | MaxSpeed 69 | true 70 | true 71 | _WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 72 | 4312 73 | 74 | 75 | Console 76 | true 77 | true 78 | true 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | Create 95 | Create 96 | 97 | 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /RIOEventDrivenPolledUDP/RIOEventDrivenPolledUDP.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #include "..\Shared\Constants.h" 4 | #include "..\Shared\Shared.h" 5 | 6 | int _tmain(int argc, _TCHAR* argv[]) 7 | { 8 | if (argc > 2) 9 | { 10 | cout << "Usage: RIOEventDrivenPolledUDP [workLoad]" << endl; 11 | } 12 | 13 | if (argc > 1) 14 | { 15 | g_workIterations = _ttol(argv[1]); 16 | } 17 | 18 | SetupTiming("RIO Event Driven Polled UDP"); 19 | 20 | InitialiseWinsock(); 21 | 22 | CreateRIOSocket(); 23 | 24 | HANDLE hEvent = WSACreateEvent(); 25 | 26 | if (hEvent == WSA_INVALID_EVENT) 27 | { 28 | ErrorExit("WSACreateEvent"); 29 | } 30 | 31 | RIO_NOTIFICATION_COMPLETION completionType; 32 | 33 | completionType.Type = RIO_EVENT_COMPLETION; 34 | completionType.Event.EventHandle = hEvent; 35 | #ifdef WE_RESET_EVENT 36 | completionType.Event.NotifyReset = FALSE; 37 | #else 38 | completionType.Event.NotifyReset = TRUE; 39 | #endif 40 | 41 | g_queue = g_rio.RIOCreateCompletionQueue(RIO_PENDING_RECVS, &completionType); 42 | 43 | if (g_queue == RIO_INVALID_CQ) 44 | { 45 | ErrorExit("RIOCreateCompletionQueue"); 46 | } 47 | 48 | ULONG maxOutstandingReceive = RIO_PENDING_RECVS; 49 | ULONG maxReceiveDataBuffers = 1; 50 | ULONG maxOutstandingSend = 0; 51 | ULONG maxSendDataBuffers = 1; 52 | 53 | void *pContext = 0; 54 | 55 | g_requestQueue = g_rio.RIOCreateRequestQueue( 56 | g_s, 57 | maxOutstandingReceive, 58 | maxReceiveDataBuffers, 59 | maxOutstandingSend, 60 | maxSendDataBuffers, 61 | g_queue, 62 | g_queue, 63 | pContext); 64 | 65 | if (g_requestQueue == RIO_INVALID_RQ) 66 | { 67 | ErrorExit("RIOCreateRequestQueue"); 68 | } 69 | 70 | PostRIORecvs(RECV_BUFFER_SIZE, RIO_PENDING_RECVS); 71 | 72 | #ifdef TRACK_THREAD_STATS 73 | ThreadData &threadData = g_threadData[0]; 74 | 75 | threadData.threadId = ::GetCurrentThreadId(); 76 | #endif 77 | 78 | bool done = false; 79 | 80 | DWORD recvFlags = 0; 81 | 82 | RIORESULT results[RIO_MAX_RESULTS]; 83 | 84 | const INT notifyResult = g_rio.RIONotify(g_queue); 85 | 86 | if (notifyResult != ERROR_SUCCESS) 87 | { 88 | ErrorExit("RIONotify"); 89 | } 90 | 91 | const DWORD waitResult = WaitForSingleObject(hEvent, INFINITE); 92 | 93 | if (waitResult != WAIT_OBJECT_0) 94 | { 95 | ErrorExit("WaitForSingleObject"); 96 | } 97 | 98 | StartTiming(); 99 | 100 | ULONG numResults = g_rio.RIODequeueCompletion(g_queue, results, RIO_MAX_RESULTS); 101 | 102 | if (0 == numResults || RIO_CORRUPT_CQ == numResults) 103 | { 104 | ErrorExit("RIODequeueCompletion"); 105 | } 106 | 107 | int workValue = 0; 108 | 109 | bool running = true; 110 | 111 | do 112 | { 113 | #ifdef TRACK_THREAD_STATS 114 | threadData.dequeueCalled++; 115 | 116 | threadData.packetsProcessed += numResults; 117 | 118 | if (numResults > threadData.maxPacketsProcessed) 119 | { 120 | threadData.maxPacketsProcessed = numResults; 121 | } 122 | 123 | if (numResults < threadData.minPacketsProcessed) 124 | { 125 | threadData.minPacketsProcessed = numResults; 126 | } 127 | #endif 128 | 129 | for (DWORD i = 0; i < numResults; ++i) 130 | { 131 | EXTENDED_RIO_BUF *pBuffer = reinterpret_cast(results[i].RequestContext); 132 | 133 | if (results[i].BytesTransferred == EXPECTED_DATA_SIZE) 134 | { 135 | g_packets++; 136 | 137 | workValue += DoWork(g_workIterations); 138 | 139 | if (!g_rio.RIOReceive( 140 | g_requestQueue, 141 | pBuffer, 142 | 1, 143 | recvFlags, 144 | pBuffer)) 145 | { 146 | ErrorExit("RIOReceive"); 147 | } 148 | 149 | done = false; 150 | } 151 | else 152 | { 153 | done = true; 154 | } 155 | } 156 | 157 | if (!done) 158 | { 159 | numResults = g_rio.RIODequeueCompletion(g_queue, results, RIO_MAX_RESULTS); 160 | 161 | /* 162 | // OR SPIN for a while.... 163 | const DWORD maxSpin = 4000; 164 | 165 | DWORD spin = 0; 166 | 167 | do 168 | { 169 | numResults = g_rio.RIODequeueCompletion( 170 | g_queue, 171 | results, 172 | RIO_MAX_RESULTS); 173 | 174 | if (0 == numResults) 175 | { 176 | YieldProcessor(); 177 | } 178 | else if (RIO_CORRUPT_CQ == numResults) 179 | { 180 | ErrorExit("RIODequeueCompletion"); 181 | } 182 | } 183 | while (0 == numResults && spin++ < maxSpin); 184 | */ 185 | 186 | if (numResults == 0) 187 | { 188 | #ifdef WE_RESET_EVENT 189 | if (!::ResetEvent(hEvent)) 190 | { 191 | ErrorExit("ResetEvent"); 192 | } 193 | #endif 194 | 195 | #ifdef TRACK_THREAD_STATS 196 | threadData.notifyCalled++; 197 | #endif 198 | 199 | INT notifyResult = g_rio.RIONotify(g_queue); 200 | 201 | if (notifyResult != ERROR_SUCCESS) 202 | { 203 | ErrorExit("RIONotify", notifyResult); 204 | } 205 | 206 | const DWORD waitResult = WaitForSingleObject(hEvent, INFINITE); 207 | 208 | if (waitResult != WAIT_OBJECT_0) 209 | { 210 | ErrorExit("WaitForSingleObject"); 211 | } 212 | 213 | numResults = g_rio.RIODequeueCompletion(g_queue, results, RIO_MAX_RESULTS); 214 | 215 | if (0 == numResults || RIO_CORRUPT_CQ == numResults) 216 | { 217 | ErrorExit("RIODequeueCompletion"); 218 | } 219 | } 220 | } 221 | } 222 | while (!done); 223 | 224 | StopTiming(); 225 | 226 | PrintTimings(); 227 | 228 | DisplayThreadStats(); 229 | 230 | return workValue; 231 | } 232 | 233 | -------------------------------------------------------------------------------- /RIOIOCPUDPMT/RIOIOCPUDPMT.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #define THREAD_STATS_SHOW_DEQUE 4 | #define THREAD_STATS_SHOW_NOTIFY 5 | #define THREAD_STATS_SHOW_MIN_MAX 6 | 7 | #include "..\Shared\Constants.h" 8 | #include "..\Shared\Shared.h" 9 | 10 | int _tmain(int argc, _TCHAR* argv[]) 11 | { 12 | if (argc > 2) 13 | { 14 | cout << "Usage: RIOIOCPUDPMT [workLoad]" << endl; 15 | } 16 | 17 | if (argc > 1) 18 | { 19 | g_workIterations = _ttol(argv[1]); 20 | } 21 | 22 | SetupTiming("RIO IOCP MT UDP"); 23 | 24 | InitialiseWinsock(); 25 | 26 | CreateRIOSocket(); 27 | 28 | HANDLE hIOCP = CreateIOCP(); 29 | 30 | OVERLAPPED overlapped; 31 | 32 | RIO_NOTIFICATION_COMPLETION completionType; 33 | 34 | completionType.Type = RIO_IOCP_COMPLETION; 35 | completionType.Iocp.IocpHandle = hIOCP; 36 | completionType.Iocp.CompletionKey = (void*)1; 37 | completionType.Iocp.Overlapped = &overlapped; 38 | 39 | g_queue = g_rio.RIOCreateCompletionQueue(RIO_PENDING_RECVS, &completionType); 40 | 41 | if (g_queue == RIO_INVALID_CQ) 42 | { 43 | ErrorExit("RIOCreateCompletionQueue"); 44 | } 45 | 46 | ULONG maxOutstandingReceive = RIO_PENDING_RECVS; 47 | ULONG maxReceiveDataBuffers = 1; 48 | ULONG maxOutstandingSend = 0; 49 | ULONG maxSendDataBuffers = 1; 50 | 51 | void *pContext = 0; 52 | 53 | g_requestQueue = g_rio.RIOCreateRequestQueue(g_s, maxOutstandingReceive, maxReceiveDataBuffers, maxOutstandingSend, maxSendDataBuffers, g_queue, g_queue, pContext); 54 | 55 | if (g_requestQueue == RIO_INVALID_RQ) 56 | { 57 | ErrorExit("RIOCreateRequestQueue"); 58 | } 59 | 60 | PostRIORecvs(RECV_BUFFER_SIZE, RIO_PENDING_RECVS); 61 | 62 | CreateIOCPThreads(NUM_IOCP_THREADS); 63 | 64 | INT notifyResult = g_rio.RIONotify(g_queue); 65 | 66 | if (notifyResult != ERROR_SUCCESS) 67 | { 68 | ErrorExit("RIONotify", notifyResult); 69 | } 70 | 71 | WaitForProcessingStarted(); 72 | 73 | WaitForProcessingStopped(); 74 | 75 | StopIOCPThreads(); 76 | 77 | PrintTimings(); 78 | 79 | CleanupRIO(); 80 | 81 | return 0; 82 | } 83 | 84 | unsigned int __stdcall ThreadFunction( 85 | void *pV) 86 | { 87 | #ifdef TRACK_THREAD_STATS 88 | const DWORD index = (DWORD)(ULONG_PTR)pV; 89 | 90 | ThreadData &threadData = g_threadData[index]; 91 | 92 | threadData.threadId = ::GetCurrentThreadId(); 93 | #endif 94 | 95 | DWORD numberOfBytes = 0; 96 | 97 | ULONG_PTR completionKey = 0; 98 | 99 | OVERLAPPED *pOverlapped = 0; 100 | 101 | DWORD recvFlags = 0; 102 | 103 | if (!::GetQueuedCompletionStatus(g_hIOCP, &numberOfBytes, &completionKey, &pOverlapped, INFINITE)) 104 | { 105 | ErrorExit("GetQueuedCompletionStatus"); 106 | } 107 | 108 | int workValue = 0; 109 | 110 | if (completionKey == 1) 111 | { 112 | RIORESULT results[RIO_MAX_RESULTS]; 113 | 114 | bool done = false; 115 | 116 | ::SetEvent(g_hStartedEvent); 117 | 118 | ULONG numResults = g_rio.RIODequeueCompletion(g_queue, results, RIO_MAX_RESULTS); 119 | 120 | if (0 == numResults || RIO_CORRUPT_CQ == numResults) 121 | { 122 | ErrorExit("RIODequeueCompletion"); 123 | } 124 | 125 | #ifdef TRACK_THREAD_STATS 126 | threadData.notifyCalled++; 127 | #endif 128 | 129 | INT notifyResult = g_rio.RIONotify(g_queue); 130 | 131 | if (notifyResult != ERROR_SUCCESS) 132 | { 133 | ErrorExit("RIONotify", notifyResult); 134 | } 135 | 136 | do 137 | { 138 | #ifdef TRACK_THREAD_STATS 139 | threadData.dequeueCalled++; 140 | 141 | threadData.packetsProcessed += numResults; 142 | 143 | if (numResults > threadData.maxPacketsProcessed) 144 | { 145 | threadData.maxPacketsProcessed = numResults; 146 | } 147 | 148 | if (numResults < threadData.minPacketsProcessed) 149 | { 150 | threadData.minPacketsProcessed = numResults; 151 | } 152 | #endif 153 | 154 | DWORD packets = 0; 155 | 156 | for (DWORD i = 0; i < numResults; ++i) 157 | { 158 | EXTENDED_RIO_BUF *pBuffer = reinterpret_cast(results[i].RequestContext); 159 | 160 | if (results[i].BytesTransferred == EXPECTED_DATA_SIZE) 161 | { 162 | workValue += DoWork(g_workIterations); 163 | 164 | packets++; 165 | 166 | ::EnterCriticalSection(&g_criticalSection); 167 | 168 | if (!g_rio.RIOReceive(g_requestQueue, pBuffer, 1, recvFlags, pBuffer)) 169 | { 170 | ErrorExit("RIOReceive"); 171 | } 172 | 173 | ::LeaveCriticalSection(&g_criticalSection); 174 | 175 | done = false; 176 | } 177 | else 178 | { 179 | done = true; 180 | } 181 | } 182 | 183 | ::InterlockedAdd(&g_packets, packets); 184 | 185 | if (!done) 186 | { 187 | if (!::GetQueuedCompletionStatus(g_hIOCP, &numberOfBytes, &completionKey, &pOverlapped, INFINITE)) 188 | { 189 | ErrorExit("GetQueuedCompletionStatus"); 190 | } 191 | 192 | if (completionKey == 0) 193 | { 194 | done = true; 195 | } 196 | else 197 | { 198 | numResults = g_rio.RIODequeueCompletion(g_queue, results, RIO_MAX_RESULTS); 199 | 200 | if (0 == numResults || RIO_CORRUPT_CQ == numResults) 201 | { 202 | ErrorExit("RIODequeueCompletion"); 203 | } 204 | 205 | #ifdef TRACK_THREAD_STATS 206 | threadData.notifyCalled++; 207 | #endif 208 | 209 | INT notifyResult = g_rio.RIONotify(g_queue); 210 | 211 | if (notifyResult != ERROR_SUCCESS) 212 | { 213 | ErrorExit("RIONotify", notifyResult); 214 | } 215 | } 216 | } 217 | } 218 | while (!done); 219 | } 220 | 221 | ::SetEvent(g_hStoppedEvent); 222 | 223 | return workValue; 224 | } 225 | 226 | -------------------------------------------------------------------------------- /RIOUDPTrafficGenerator/RIOUDPTrafficGenerator.cpp: -------------------------------------------------------------------------------- 1 | // RIOTest.cpp : Defines the entry point for the console application. 2 | // 3 | 4 | #include "stdafx.h" 5 | 6 | #include "..\Shared\Constants.h" 7 | #include "..\Shared\Shared.h" 8 | 9 | int main(int argc, char* argv[]) 10 | { 11 | if (argc < 2 || argc > 4) 12 | { 13 | cout << "Error: no remote address specified" << endl; 14 | cout << "Usage: RIOUDPTrafficGeneraor [datagrams to send] [shutdown datagrams to send]" << endl; 15 | } 16 | 17 | long datagramsToSend = DATAGRAMS_TO_SEND; 18 | 19 | if (argc > 2) 20 | { 21 | datagramsToSend = atol(argv[2]); 22 | } 23 | 24 | long shutdownDatagramsToSend = SHUTDOWN_DATAGRAMS_TO_SEND; 25 | 26 | if (argc > 3) 27 | { 28 | shutdownDatagramsToSend = atol(argv[3]); 29 | } 30 | 31 | const char *pAddress = argv[1]; 32 | 33 | SetupTiming("RIO UDP Traffic generator", false); 34 | 35 | cout << "Datagrams to send: " << datagramsToSend << endl; 36 | cout << "Shutdown datagrams: " << shutdownDatagramsToSend << endl; 37 | 38 | InitialiseWinsock(); 39 | 40 | CreateRIOSocket(false); 41 | 42 | sockaddr_in addr; 43 | 44 | addr.sin_family = AF_INET; 45 | addr.sin_port = htons(PORT); 46 | addr.sin_addr.s_addr = inet_addr(pAddress); 47 | 48 | bool done = false; 49 | 50 | bool shutdown = false; 51 | 52 | const DWORD sendFlags = 0; 53 | 54 | DWORD bufferSize = 0; 55 | 56 | DWORD sendBuffersAllocated = 0; 57 | 58 | char *pBuffer = AllocateBufferSpace(SEND_BUFFER_SIZE, datagramsToSend, bufferSize, sendBuffersAllocated); 59 | 60 | RIO_BUFFERID id = g_rio.RIORegisterBuffer(pBuffer, static_cast(bufferSize)); 61 | 62 | g_buffers.push_back(id); 63 | 64 | if (id == RIO_INVALID_BUFFERID) 65 | { 66 | ErrorExit("RIORegisterBuffer"); 67 | } 68 | 69 | DWORD offset = 0; 70 | 71 | DWORD recvFlags = 0; 72 | 73 | EXTENDED_RIO_BUF *pBufs = new EXTENDED_RIO_BUF[sendBuffersAllocated]; 74 | 75 | for (DWORD i = 0; i < sendBuffersAllocated; ++i) 76 | { 77 | // now split into buffer slices and post our recvs 78 | 79 | EXTENDED_RIO_BUF *pBuffer = pBufs + i; 80 | 81 | pBuffer->operation = 0; 82 | pBuffer->BufferId = id; 83 | pBuffer->Offset = offset; 84 | pBuffer->Length = SEND_BUFFER_SIZE; 85 | 86 | offset += SEND_BUFFER_SIZE; 87 | } 88 | 89 | g_queue = g_rio.RIOCreateCompletionQueue(sendBuffersAllocated, 0); 90 | 91 | if (g_queue == RIO_INVALID_CQ) 92 | { 93 | ErrorExit("RIOCreateCompletionQueue"); 94 | } 95 | 96 | ULONG maxOutstandingReceive = 0; 97 | ULONG maxReceiveDataBuffers = 1; 98 | ULONG maxOutstandingSend = sendBuffersAllocated; 99 | ULONG maxSendDataBuffers = 1; 100 | 101 | void *pContext = 0; 102 | 103 | g_requestQueue = g_rio.RIOCreateRequestQueue( 104 | g_s, 105 | maxOutstandingReceive, 106 | maxReceiveDataBuffers, 107 | maxOutstandingSend, 108 | maxSendDataBuffers, 109 | g_queue, 110 | g_queue, 111 | pContext); 112 | 113 | if (g_requestQueue == RIO_INVALID_RQ) 114 | { 115 | ErrorExit("RIOCreateRequestQueue"); 116 | } 117 | 118 | if (SOCKET_ERROR == ::connect(g_s, reinterpret_cast(&addr), sizeof(addr))) 119 | { 120 | ErrorExit("connect"); 121 | } 122 | 123 | StartTiming(); 124 | 125 | for (size_t i = 0; i < sendBuffersAllocated; ++i) 126 | { 127 | ++g_packets; 128 | 129 | if (!shutdown && g_packets > datagramsToSend) 130 | { 131 | if (shutdown) 132 | { 133 | StopTiming(); 134 | 135 | shutdown = true; 136 | } 137 | 138 | pBufs[i].Length = SEND_BUFFER_SIZE / 2; 139 | } 140 | 141 | if (g_packets > datagramsToSend + shutdownDatagramsToSend) 142 | { 143 | done = true; 144 | } 145 | 146 | if (!done) 147 | { 148 | if (!g_rio.RIOSend(g_requestQueue, &pBufs[i], 1, sendFlags, &pBufs[i])) 149 | { 150 | ErrorExit("RIOSend"); 151 | } 152 | } 153 | } 154 | 155 | if (!done) 156 | { 157 | DWORD recvFlags = 0; 158 | 159 | RIORESULT results[RIO_MAX_RESULTS]; 160 | 161 | ULONG numResults = 0; 162 | 163 | do 164 | { 165 | numResults = g_rio.RIODequeueCompletion( 166 | g_queue, 167 | results, 168 | RIO_MAX_RESULTS); 169 | 170 | if (0 == numResults) 171 | { 172 | YieldProcessor(); 173 | } 174 | else if (RIO_CORRUPT_CQ == numResults) 175 | { 176 | ErrorExit("RIODequeueCompletion"); 177 | } 178 | } 179 | while (0 == numResults); 180 | 181 | do 182 | { 183 | for (DWORD i = 0; i < numResults; ++i) 184 | { 185 | EXTENDED_RIO_BUF *pBuffer = reinterpret_cast(results[i].RequestContext); 186 | 187 | ++g_packets; 188 | 189 | if (shutdown || g_packets > datagramsToSend) 190 | { 191 | if (!shutdown) 192 | { 193 | StopTiming(); 194 | 195 | shutdown = true; 196 | } 197 | 198 | pBuffer->Length = SEND_BUFFER_SIZE / 2; 199 | } 200 | 201 | if (g_packets > datagramsToSend + shutdownDatagramsToSend) 202 | { 203 | done = true; 204 | } 205 | 206 | if (!done) 207 | { 208 | if (!g_rio.RIOSend(g_requestQueue, pBuffer, 1, sendFlags, pBuffer)) 209 | { 210 | ErrorExit("RIOSend"); 211 | } 212 | } 213 | } 214 | 215 | if (!done) 216 | { 217 | do 218 | { 219 | numResults = g_rio.RIODequeueCompletion( 220 | g_queue, 221 | results, 222 | RIO_MAX_RESULTS); 223 | 224 | if (0 == numResults) 225 | { 226 | YieldProcessor(); 227 | } 228 | else if (RIO_CORRUPT_CQ == numResults) 229 | { 230 | ErrorExit("RIODequeueCompletion"); 231 | } 232 | } 233 | while (0 == numResults); 234 | } 235 | } 236 | while (!done); 237 | } 238 | 239 | PrintTimings("Sent "); 240 | 241 | CleanupRIO(); 242 | 243 | return 0; 244 | } 245 | 246 | -------------------------------------------------------------------------------- /RIOTest/RIOTest/MSWinSock.cpp: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // File: MSWinSock.cpp 3 | /////////////////////////////////////////////////////////////////////////////// 4 | // 5 | // Copyright 2002 JetByte Limited. 6 | // 7 | // This software is provided "as is" without a warranty of any kind. All 8 | // express or implied conditions, representations and warranties, including 9 | // any implied warranty of merchantability, fitness for a particular purpose 10 | // or non-infringement, are hereby excluded. JetByte Limited and its licensors 11 | // shall not be liable for any damages suffered by licensee as a result of 12 | // using the software. In no event will JetByte Limited be liable for any 13 | // lost revenue, profit or data, or for direct, indirect, special, 14 | // consequential, incidental or punitive damages, however caused and regardless 15 | // of the theory of liability, arising out of the use of or inability to use 16 | // software, even if JetByte Limited has been advised of the possibility of 17 | // such damages. 18 | // 19 | /////////////////////////////////////////////////////////////////////////////// 20 | 21 | //#include "JetByteTools\Admin\Admin.h" 22 | 23 | #include "MSWinSock.h" 24 | #include "stdafx.h" 25 | 26 | //#include "JetByteTools\Win32Tools\Exception.h" 27 | //#include "JetByteTools\Win32Tools\Utils.h" 28 | 29 | #pragma hdrstop 30 | 31 | /////////////////////////////////////////////////////////////////////////////// 32 | // Using directives 33 | /////////////////////////////////////////////////////////////////////////////// 34 | 35 | //using JetByteTools::Win32::ToBool; 36 | //using JetByteTools::Win32::CException; 37 | 38 | /////////////////////////////////////////////////////////////////////////////// 39 | // Namespace: JetByteTools::Socket 40 | /////////////////////////////////////////////////////////////////////////////// 41 | 42 | namespace JetByteTools { 43 | namespace Socket { 44 | 45 | /////////////////////////////////////////////////////////////////////////////// 46 | // Static helper functions 47 | /////////////////////////////////////////////////////////////////////////////// 48 | 49 | static bool LoadExtensionFunction( 50 | SOCKET s, 51 | GUID functionID, 52 | void **ppFunc); 53 | 54 | /////////////////////////////////////////////////////////////////////////////// 55 | // CUsesMSWinSockExtensions 56 | /////////////////////////////////////////////////////////////////////////////// 57 | 58 | CUsesMSWinSockExtensions::CUsesMSWinSockExtensions() 59 | : m_pRIOAPI(new RIO_EXTENSION_FUNCTION_TABLE()) 60 | { 61 | //memset(m_pRIOAPI, 0, sizeof(RIO_EXTENSION_FUNCTION_TABLE)); 62 | //m_pRIOAPI->cbSize = sizeof(RIO_EXTENSION_FUNCTION_TABLE); 63 | 64 | } 65 | 66 | bool CUsesMSWinSockExtensions::LoadRIOAPI( 67 | SOCKET s) 68 | { 69 | GUID functionTableId = WSAID_MULTIPLE_RIO; 70 | 71 | DWORD dwBytes = 0; 72 | 73 | bool ok = true; 74 | 75 | if (0 != WSAIoctl( 76 | s, 77 | SIO_GET_MULTIPLE_EXTENSION_FUNCTION_POINTER, 78 | &functionTableId, 79 | sizeof(GUID), 80 | (void**)m_pRIOAPI, 81 | sizeof(RIO_EXTENSION_FUNCTION_TABLE), 82 | &dwBytes, 83 | 0, 84 | 0)) 85 | { 86 | const DWORD lastError = ::GetLastError(); 87 | 88 | ok = false; 89 | } 90 | 91 | return ok && m_pRIOAPI; 92 | } 93 | 94 | bool CUsesMSWinSockExtensions::RIOReceive( 95 | RIO_RQ socketQueue, 96 | PRIO_BUF pData, 97 | ULONG dataBufferCount, 98 | DWORD flags, 99 | PVOID requestContext) const 100 | { 101 | if (!m_pRIOAPI) 102 | { 103 | throw "TODO"; 104 | } 105 | 106 | if (TRUE != m_pRIOAPI->RIOReceive(socketQueue, pData, dataBufferCount, flags, requestContext)) 107 | { 108 | const DWORD lastError = ::GetLastError(); 109 | 110 | } 111 | 112 | return true; 113 | } 114 | 115 | bool CUsesMSWinSockExtensions::RIOSend( 116 | RIO_RQ socketQueue, 117 | PRIO_BUF pData, 118 | ULONG dataBufferCount, 119 | DWORD flags, 120 | PVOID requestContext) const 121 | { 122 | if (!m_pRIOAPI) 123 | { 124 | throw "TODO"; 125 | } 126 | 127 | if (TRUE != m_pRIOAPI->RIOSend(socketQueue, pData, dataBufferCount, flags, requestContext)) 128 | { 129 | const DWORD lastError = ::GetLastError(); 130 | 131 | } 132 | 133 | return true; 134 | } 135 | 136 | RIO_RQ CUsesMSWinSockExtensions::RIOCreateRequestQueue( 137 | SOCKET socket, 138 | ULONG maxOutstandingReceive, 139 | ULONG maxReceiveDataBuffers, 140 | ULONG maxOutstandingSend, 141 | ULONG maxSendDataBuffers, 142 | RIO_CQ receiveCQ, 143 | RIO_CQ sendCQ, 144 | PVOID socketContext) const 145 | { 146 | if (!m_pRIOAPI) 147 | { 148 | throw "TODO"; 149 | } 150 | 151 | RIO_RQ requestQueue = m_pRIOAPI->RIOCreateRequestQueue(socket, maxOutstandingReceive, maxReceiveDataBuffers, maxOutstandingSend, maxSendDataBuffers, receiveCQ, sendCQ, socketContext); 152 | 153 | if (requestQueue == RIO_INVALID_RQ) 154 | { 155 | const DWORD lastError = ::GetLastError(); 156 | 157 | throw "TODO"; 158 | } 159 | 160 | return requestQueue; 161 | } 162 | 163 | RIO_CQ CUsesMSWinSockExtensions::RIOCreateCompletionQueue( 164 | DWORD queueSize, 165 | PRIO_NOTIFICATION_COMPLETION notificationCompletion) const 166 | { 167 | if (!m_pRIOAPI) 168 | { 169 | throw "TODO"; 170 | } 171 | 172 | const RIO_CQ completionQueue = m_pRIOAPI->RIOCreateCompletionQueue(queueSize, notificationCompletion); 173 | 174 | if (completionQueue == RIO_INVALID_CQ) 175 | { 176 | const DWORD lastError = ::GetLastError(); 177 | 178 | throw "TODO"; 179 | } 180 | 181 | return completionQueue; 182 | } 183 | 184 | void CUsesMSWinSockExtensions::RIOCloseCompletionQueue( 185 | RIO_CQ completionQueue) const 186 | { 187 | if (!m_pRIOAPI) 188 | { 189 | throw "TODO"; 190 | } 191 | 192 | m_pRIOAPI->RIOCloseCompletionQueue(completionQueue); 193 | } 194 | 195 | RIO_BUFFERID CUsesMSWinSockExtensions::RIORegisterBuffer( 196 | PCHAR DataBuffer, 197 | DWORD DataLength) 198 | { 199 | if (!m_pRIOAPI) 200 | { 201 | throw "TODO"; 202 | } 203 | 204 | RIO_BUFFERID id = m_pRIOAPI->RIORegisterBuffer(DataBuffer, DataLength); 205 | 206 | if (id == RIO_INVALID_BUFFERID) 207 | { 208 | const DWORD lastError = ::GetLastError(); 209 | 210 | throw "TODO"; 211 | } 212 | 213 | return id; 214 | 215 | } 216 | 217 | void CUsesMSWinSockExtensions::RIODeregisterBuffer( 218 | RIO_BUFFERID id) 219 | { 220 | if (!m_pRIOAPI) 221 | { 222 | throw "TODO"; 223 | } 224 | 225 | m_pRIOAPI->RIODeregisterBuffer(id); 226 | } 227 | 228 | /////////////////////////////////////////////////////////////////////////////// 229 | // Namespace: JetByteTools::Socket 230 | /////////////////////////////////////////////////////////////////////////////// 231 | 232 | } // End of namespace Socket 233 | } // End of namespace JetByteTools 234 | 235 | /////////////////////////////////////////////////////////////////////////////// 236 | // End of file: MSWinSock.cpp 237 | /////////////////////////////////////////////////////////////////////////////// 238 | 239 | -------------------------------------------------------------------------------- /RIOIOCPPolledUDPMT/RIOIOCPPolledUDPMT.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #define THREAD_STATS_SHOW_DEQUE 4 | #define THREAD_STATS_SHOW_NOTIFY 5 | #define THREAD_STATS_SHOW_MIN_MAX 6 | 7 | #include "..\Shared\Constants.h" 8 | #include "..\Shared\Shared.h" 9 | 10 | int _tmain(int argc, _TCHAR* argv[]) 11 | { 12 | if (argc > 2) 13 | { 14 | cout << "Usage: RIOIOCPPolledUDPMT [workLoad]" << endl; 15 | } 16 | 17 | if (argc > 1) 18 | { 19 | g_workIterations = _ttol(argv[1]); 20 | } 21 | 22 | SetupTiming("RIO IOCP Polled MT UDP"); 23 | 24 | InitialiseWinsock(); 25 | 26 | CreateRIOSocket(); 27 | 28 | HANDLE hIOCP = CreateIOCP(); 29 | 30 | OVERLAPPED overlapped; 31 | 32 | RIO_NOTIFICATION_COMPLETION completionType; 33 | 34 | completionType.Type = RIO_IOCP_COMPLETION; 35 | completionType.Iocp.IocpHandle = hIOCP; 36 | completionType.Iocp.CompletionKey = (void*)1; 37 | completionType.Iocp.Overlapped = &overlapped; 38 | 39 | g_queue = g_rio.RIOCreateCompletionQueue(RIO_PENDING_RECVS, &completionType); 40 | 41 | if (g_queue == RIO_INVALID_CQ) 42 | { 43 | ErrorExit("RIOCreateCompletionQueue"); 44 | } 45 | 46 | ULONG maxOutstandingReceive = RIO_PENDING_RECVS; 47 | ULONG maxReceiveDataBuffers = 1; 48 | ULONG maxOutstandingSend = 0; 49 | ULONG maxSendDataBuffers = 1; 50 | 51 | void *pContext = 0; 52 | 53 | g_requestQueue = g_rio.RIOCreateRequestQueue(g_s, maxOutstandingReceive, maxReceiveDataBuffers, maxOutstandingSend, maxSendDataBuffers, g_queue, g_queue, pContext); 54 | 55 | if (g_requestQueue == RIO_INVALID_RQ) 56 | { 57 | ErrorExit("RIOCreateRequestQueue"); 58 | } 59 | 60 | PostRIORecvs(RECV_BUFFER_SIZE, RIO_PENDING_RECVS); 61 | 62 | CreateIOCPThreads(NUM_IOCP_THREADS); 63 | 64 | INT notifyResult = g_rio.RIONotify(g_queue); 65 | 66 | if (notifyResult != ERROR_SUCCESS) 67 | { 68 | ErrorExit("RIONotify", notifyResult); 69 | } 70 | 71 | WaitForProcessingStarted(); 72 | 73 | WaitForProcessingStopped(); 74 | 75 | StopIOCPThreads(); 76 | 77 | PrintTimings(); 78 | 79 | return 0; 80 | } 81 | 82 | unsigned int __stdcall ThreadFunction( 83 | void *pV) 84 | { 85 | #ifdef TRACK_THREAD_STATS 86 | const DWORD index = (DWORD)(ULONG_PTR)pV; 87 | 88 | ThreadData &threadData = g_threadData[index]; 89 | 90 | threadData.threadId = ::GetCurrentThreadId(); 91 | #endif 92 | 93 | DWORD numberOfBytes = 0; 94 | 95 | ULONG_PTR completionKey = 0; 96 | 97 | OVERLAPPED *pOverlapped = 0; 98 | 99 | DWORD recvFlags = 0; 100 | 101 | if (!::GetQueuedCompletionStatus(g_hIOCP, &numberOfBytes, &completionKey, &pOverlapped, INFINITE)) 102 | { 103 | ErrorExit("GetQueuedCompletionStatus"); 104 | } 105 | 106 | int workValue = 0; 107 | 108 | if (completionKey == 1) 109 | { 110 | RIORESULT results[RIO_MAX_RESULTS]; 111 | 112 | bool done = false; 113 | 114 | ::SetEvent(g_hStartedEvent); 115 | 116 | ULONG numResults = g_rio.RIODequeueCompletion(g_queue, results, RIO_MAX_RESULTS); 117 | 118 | if (0 == numResults || RIO_CORRUPT_CQ == numResults) 119 | { 120 | ErrorExit("RIODequeueCompletion"); 121 | } 122 | 123 | bool waitForCompletion = (numResults >= RIO_RESULTS_THRESHOLD); 124 | 125 | if (waitForCompletion) 126 | { 127 | #ifdef TRACK_THREAD_STATS 128 | threadData.notifyCalled++; 129 | #endif 130 | 131 | INT notifyResult = g_rio.RIONotify(g_queue); 132 | 133 | if (notifyResult != ERROR_SUCCESS) 134 | { 135 | ErrorExit("RIONotify", notifyResult); 136 | } 137 | } 138 | 139 | do 140 | { 141 | #ifdef TRACK_THREAD_STATS 142 | threadData.dequeueCalled++; 143 | 144 | threadData.packetsProcessed += numResults; 145 | 146 | if (numResults > threadData.maxPacketsProcessed) 147 | { 148 | threadData.maxPacketsProcessed = numResults; 149 | } 150 | 151 | if (numResults < threadData.minPacketsProcessed) 152 | { 153 | threadData.minPacketsProcessed = numResults; 154 | } 155 | #endif 156 | 157 | DWORD packets = 0; 158 | 159 | for (DWORD i = 0; i < numResults; ++i) 160 | { 161 | EXTENDED_RIO_BUF *pBuffer = reinterpret_cast(results[i].RequestContext); 162 | 163 | if (results[i].BytesTransferred == EXPECTED_DATA_SIZE) 164 | { 165 | workValue += DoWork(g_workIterations); 166 | 167 | packets++; 168 | 169 | ::EnterCriticalSection(&g_criticalSection); 170 | 171 | if (!g_rio.RIOReceive(g_requestQueue, pBuffer, 1, recvFlags, pBuffer)) 172 | { 173 | ErrorExit("RIOReceive"); 174 | } 175 | 176 | ::LeaveCriticalSection(&g_criticalSection); 177 | 178 | done = false; 179 | } 180 | else 181 | { 182 | done = true; 183 | } 184 | } 185 | 186 | ::InterlockedAdd(&g_packets, packets); 187 | 188 | if (!done) 189 | { 190 | if (waitForCompletion) 191 | { 192 | if (!::GetQueuedCompletionStatus(g_hIOCP, &numberOfBytes, &completionKey, &pOverlapped, INFINITE)) 193 | { 194 | ErrorExit("GetQueuedCompletionStatus"); 195 | } 196 | 197 | if (completionKey == 0) 198 | { 199 | done = true; 200 | } 201 | } 202 | 203 | if (!done) 204 | { 205 | // could spin here on 0, with a spin count 206 | 207 | numResults = g_rio.RIODequeueCompletion(g_queue, results, RIO_MAX_RESULTS); 208 | 209 | if (RIO_CORRUPT_CQ == numResults) 210 | { 211 | ErrorExit("RIODequeueCompletion"); 212 | } 213 | 214 | if (numResults == 0) 215 | { 216 | if (!waitForCompletion) 217 | { 218 | #ifdef TRACK_THREAD_STATS 219 | threadData.notifyCalled++; 220 | #endif 221 | 222 | INT notifyResult = g_rio.RIONotify(g_queue); 223 | 224 | if (notifyResult != ERROR_SUCCESS) 225 | { 226 | ErrorExit("RIONotify", notifyResult); 227 | } 228 | } 229 | else 230 | { 231 | ErrorExit("RIODequeueCompletion"); 232 | } 233 | 234 | if (!::GetQueuedCompletionStatus(g_hIOCP, &numberOfBytes, &completionKey, &pOverlapped, INFINITE)) 235 | { 236 | ErrorExit("GetQueuedCompletionStatus"); 237 | } 238 | 239 | if (completionKey == 0) 240 | { 241 | done = true; 242 | } 243 | else 244 | { 245 | numResults = g_rio.RIODequeueCompletion(g_queue, results, RIO_MAX_RESULTS); 246 | 247 | if (0 == numResults || RIO_CORRUPT_CQ == numResults) 248 | { 249 | ErrorExit("RIODequeueCompletion"); 250 | } 251 | } 252 | } 253 | 254 | waitForCompletion = (numResults >= RIO_RESULTS_THRESHOLD); 255 | 256 | if (waitForCompletion) 257 | { 258 | #ifdef TRACK_THREAD_STATS 259 | threadData.notifyCalled++; 260 | #endif 261 | 262 | INT notifyResult = g_rio.RIONotify(g_queue); 263 | 264 | if (notifyResult != ERROR_SUCCESS) 265 | { 266 | ErrorExit("RIONotify", notifyResult); 267 | } 268 | } 269 | } 270 | } 271 | } 272 | while (!done); 273 | } 274 | 275 | ::SetEvent(g_hStoppedEvent); 276 | 277 | return workValue; 278 | } 279 | 280 | -------------------------------------------------------------------------------- /RIOIOCPUDPMTReaderThread/RIOIOCPUDPMTReaderThread.cpp: -------------------------------------------------------------------------------- 1 | #include "stdafx.h" 2 | 3 | #define THREAD_STATS_SHOW_DEQUE 4 | #define THREAD_STATS_SHOW_NOTIFY 5 | #define THREAD_STATS_SHOW_MIN_MAX 6 | 7 | #include "..\Shared\Constants.h" 8 | #include "..\Shared\Shared.h" 9 | 10 | int _tmain(int argc, _TCHAR* argv[]) 11 | { 12 | if (argc > 2) 13 | { 14 | cout << "Usage: RIOIOCPUDPMTReaderThread [workLoad]" << endl; 15 | } 16 | 17 | if (argc > 1) 18 | { 19 | g_workIterations = _ttol(argv[1]); 20 | } 21 | 22 | SetupTiming("RIO IOCP MT UDP ReaderThread"); 23 | 24 | InitialiseWinsock(); 25 | 26 | CreateRIOSocket(); 27 | 28 | HANDLE hIOCP = CreateIOCP(); 29 | 30 | OVERLAPPED overlapped; 31 | 32 | RIO_NOTIFICATION_COMPLETION completionType; 33 | 34 | completionType.Type = RIO_IOCP_COMPLETION; 35 | completionType.Iocp.IocpHandle = hIOCP; 36 | completionType.Iocp.CompletionKey = (void*)1; 37 | completionType.Iocp.Overlapped = &overlapped; 38 | 39 | g_queue = g_rio.RIOCreateCompletionQueue(RIO_PENDING_RECVS, &completionType); 40 | 41 | if (g_queue == RIO_INVALID_CQ) 42 | { 43 | ErrorExit("RIOCreateCompletionQueue"); 44 | } 45 | 46 | ULONG maxOutstandingReceive = RIO_PENDING_RECVS; 47 | ULONG maxReceiveDataBuffers = 1; 48 | ULONG maxOutstandingSend = 0; 49 | ULONG maxSendDataBuffers = 1; 50 | 51 | void *pContext = 0; 52 | 53 | g_requestQueue = g_rio.RIOCreateRequestQueue(g_s, maxOutstandingReceive, maxReceiveDataBuffers, maxOutstandingSend, maxSendDataBuffers, g_queue, g_queue, pContext); 54 | 55 | if (g_requestQueue == RIO_INVALID_RQ) 56 | { 57 | ErrorExit("RIOCreateRequestQueue"); 58 | } 59 | 60 | PostRIORecvs(RECV_BUFFER_SIZE, RIO_PENDING_RECVS); 61 | 62 | CreateIOCPThreads(NUM_IOCP_THREADS); 63 | 64 | CreateReaderThread(); 65 | 66 | INT notifyResult = g_rio.RIONotify(g_queue); 67 | 68 | if (notifyResult != ERROR_SUCCESS) 69 | { 70 | ErrorExit("RIONotify", notifyResult); 71 | } 72 | 73 | WaitForProcessingStarted(); 74 | 75 | WaitForProcessingStopped(); 76 | 77 | StopIOCPThreads(); 78 | 79 | StopReaderThread(); 80 | 81 | PrintTimings(); 82 | 83 | CleanupRIO(); 84 | 85 | return 0; 86 | } 87 | 88 | unsigned int __stdcall ThreadFunction( 89 | void *pV) 90 | { 91 | #ifdef TRACK_THREAD_STATS 92 | const DWORD index = (DWORD)(ULONG_PTR)pV; 93 | 94 | ThreadData &threadData = g_threadData[index]; 95 | 96 | threadData.threadId = ::GetCurrentThreadId(); 97 | #endif 98 | 99 | DWORD numberOfBytes = 0; 100 | 101 | ULONG_PTR completionKey = 0; 102 | 103 | OVERLAPPED *pOverlapped = 0; 104 | 105 | if (!::GetQueuedCompletionStatus(g_hIOCP, &numberOfBytes, &completionKey, &pOverlapped, INFINITE)) 106 | { 107 | ErrorExit("GetQueuedCompletionStatus"); 108 | } 109 | 110 | int workValue = 0; 111 | 112 | if (completionKey == 1) 113 | { 114 | RIORESULT results[RIO_MAX_RESULTS]; 115 | 116 | bool done = false; 117 | 118 | ::SetEvent(g_hStartedEvent); 119 | 120 | ULONG numResults = g_rio.RIODequeueCompletion(g_queue, results, RIO_MAX_RESULTS); 121 | 122 | if (0 == numResults || RIO_CORRUPT_CQ == numResults) 123 | { 124 | ErrorExit("RIODequeueCompletion"); 125 | } 126 | 127 | #ifdef TRACK_THREAD_STATS 128 | threadData.notifyCalled++; 129 | #endif 130 | 131 | INT notifyResult = g_rio.RIONotify(g_queue); 132 | 133 | if (notifyResult != ERROR_SUCCESS) 134 | { 135 | ErrorExit("RIONotify", notifyResult); 136 | } 137 | 138 | do 139 | { 140 | #ifdef TRACK_THREAD_STATS 141 | threadData.dequeueCalled++; 142 | 143 | threadData.packetsProcessed += numResults; 144 | 145 | if (numResults > threadData.maxPacketsProcessed) 146 | { 147 | threadData.maxPacketsProcessed = numResults; 148 | } 149 | 150 | if (numResults < threadData.minPacketsProcessed) 151 | { 152 | threadData.minPacketsProcessed = numResults; 153 | } 154 | #endif 155 | 156 | DWORD packets = 0; 157 | 158 | EXTENDED_RIO_BUF *pHead = 0; 159 | 160 | EXTENDED_RIO_BUF *pTail = 0; 161 | 162 | for (DWORD i = 0; i < numResults; ++i) 163 | { 164 | EXTENDED_RIO_BUF *pBuffer = reinterpret_cast(results[i].RequestContext); 165 | 166 | if (results[i].BytesTransferred == EXPECTED_DATA_SIZE) 167 | { 168 | workValue += DoWork(g_workIterations); 169 | 170 | packets++; 171 | 172 | pBuffer->pNext = pHead; 173 | pHead = pBuffer; 174 | 175 | if (!pTail) 176 | { 177 | pTail = pBuffer; 178 | } 179 | 180 | done = false; 181 | } 182 | else 183 | { 184 | done = true; 185 | } 186 | } 187 | 188 | if (pTail) 189 | { 190 | ::EnterCriticalSection(&g_criticalSection); 191 | 192 | EXTENDED_RIO_BUF *pReadList = reinterpret_cast(InterlockedExchangePointer(&g_pReadList, 0)); 193 | 194 | pTail->pNext = pReadList; 195 | 196 | InterlockedExchangePointer(&g_pReadList, pHead); 197 | 198 | if (!::SetEvent(g_hReadsToProcessEvent)) 199 | { 200 | ErrorExit("SetEvent"); 201 | } 202 | 203 | g_packets += packets; 204 | 205 | ::LeaveCriticalSection(&g_criticalSection); 206 | } 207 | 208 | if (!done) 209 | { 210 | if (!::GetQueuedCompletionStatus(g_hIOCP, &numberOfBytes, &completionKey, &pOverlapped, INFINITE)) 211 | { 212 | ErrorExit("GetQueuedCompletionStatus"); 213 | } 214 | 215 | if (completionKey == 0) 216 | { 217 | done = true; 218 | } 219 | else 220 | { 221 | numResults = g_rio.RIODequeueCompletion(g_queue, results, RIO_MAX_RESULTS); 222 | 223 | if (0 == numResults || RIO_CORRUPT_CQ == numResults) 224 | { 225 | ErrorExit("RIODequeueCompletion"); 226 | } 227 | 228 | #ifdef TRACK_THREAD_STATS 229 | threadData.notifyCalled++; 230 | #endif 231 | 232 | INT notifyResult = g_rio.RIONotify(g_queue); 233 | 234 | if (notifyResult != ERROR_SUCCESS) 235 | { 236 | ErrorExit("RIONotify", notifyResult); 237 | } 238 | } 239 | } 240 | } 241 | while (!done); 242 | } 243 | 244 | ::SetEvent(g_hStoppedEvent); 245 | 246 | return workValue; 247 | } 248 | 249 | unsigned int __stdcall ReaderThreadFunction( 250 | void *pV) 251 | { 252 | HANDLE handles[2]; 253 | 254 | handles[0] = g_hReadsToProcessEvent; 255 | handles[1] = g_hShutdownReaderThreadEvent; 256 | 257 | bool done = false; 258 | 259 | DWORD recvFlags = 0; 260 | 261 | while (!done) 262 | { 263 | const DWORD waitResult = ::WaitForMultipleObjects(2, handles, FALSE, INFINITE); 264 | 265 | if (waitResult == WAIT_OBJECT_0) 266 | { 267 | // interlocked exchange pointer for the head of the list 268 | // consume the list of buffers and issue reads 269 | 270 | EXTENDED_RIO_BUF *pBuffer = reinterpret_cast(InterlockedExchangePointer(&g_pReadList, 0)); 271 | 272 | while (pBuffer) 273 | { 274 | if (!g_rio.RIOReceive( 275 | g_requestQueue, 276 | pBuffer, 277 | 1, 278 | recvFlags, 279 | pBuffer)) 280 | { 281 | ErrorExit("RIOReceive"); 282 | } 283 | 284 | pBuffer = pBuffer->pNext; 285 | } 286 | } 287 | else if (waitResult == WAIT_OBJECT_0 + 1) 288 | { 289 | done = true; 290 | } 291 | else 292 | { 293 | ErrorExit("WaitForSingleObject"); 294 | } 295 | } 296 | return 0; 297 | } 298 | 299 | -------------------------------------------------------------------------------- /RIOIOCPPolledUDPMT/RIOIOCPPolledUDPMT.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | 23 | {5A928D88-9262-4680-ADF1-E0230CB2F6A9} 24 | Win32Proj 25 | RIOIOCPPolledUDPMT 26 | 27 | 28 | 29 | Application 30 | true 31 | v143 32 | Unicode 33 | 34 | 35 | Application 36 | true 37 | v143 38 | Unicode 39 | 40 | 41 | Application 42 | false 43 | v143 44 | true 45 | Unicode 46 | 47 | 48 | Application 49 | false 50 | v143 51 | true 52 | Unicode 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | true 72 | 73 | 74 | true 75 | 76 | 77 | false 78 | 79 | 80 | false 81 | 82 | 83 | 84 | Use 85 | Level3 86 | Disabled 87 | _WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 88 | 89 | 90 | Console 91 | true 92 | 93 | 94 | 95 | 96 | Use 97 | Level3 98 | Disabled 99 | _WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 100 | 4312 101 | 102 | 103 | Console 104 | true 105 | 106 | 107 | 108 | 109 | Level3 110 | Use 111 | MaxSpeed 112 | true 113 | true 114 | _WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 115 | 116 | 117 | Console 118 | true 119 | true 120 | true 121 | 122 | 123 | 124 | 125 | Level3 126 | Use 127 | MaxSpeed 128 | true 129 | true 130 | _WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 131 | 4312 132 | 133 | 134 | Console 135 | true 136 | true 137 | true 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | Create 150 | Create 151 | Create 152 | Create 153 | 154 | 155 | 156 | 157 | 158 | -------------------------------------------------------------------------------- /RIOUDPTrafficGenerator/RIOUDPTrafficGenerator.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | $(VCTargetsPath11) 23 | 24 | 25 | {A54BA78D-6347-46CB-A23E-E4BAF2725846} 26 | Win32Proj 27 | RIOUDPTrafficGenerator 28 | 29 | 30 | 31 | Application 32 | true 33 | v143 34 | Unicode 35 | 36 | 37 | Application 38 | true 39 | v143 40 | Unicode 41 | 42 | 43 | Application 44 | false 45 | v143 46 | true 47 | Unicode 48 | 49 | 50 | Application 51 | false 52 | v143 53 | true 54 | Unicode 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | true 74 | 75 | 76 | true 77 | 78 | 79 | false 80 | 81 | 82 | false 83 | 84 | 85 | 86 | Use 87 | Level3 88 | Disabled 89 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 90 | 91 | 92 | Console 93 | true 94 | 95 | 96 | 97 | 98 | Use 99 | Level3 100 | Disabled 101 | _WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 102 | 4312 103 | 104 | 105 | Console 106 | true 107 | 108 | 109 | 110 | 111 | Level3 112 | Use 113 | MaxSpeed 114 | true 115 | true 116 | _WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 117 | 118 | 119 | Console 120 | true 121 | true 122 | true 123 | 124 | 125 | 126 | 127 | Level3 128 | Use 129 | MaxSpeed 130 | true 131 | true 132 | _WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 133 | 4312 134 | 135 | 136 | Console 137 | true 138 | true 139 | true 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | Create 150 | Create 151 | Create 152 | Create 153 | 154 | 155 | 156 | 157 | 158 | -------------------------------------------------------------------------------- /IOCPUDP/IOCPUDP.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | $(VCTargetsPath11) 23 | 24 | 25 | {325A75CE-D7FA-4FA9-91AA-91EDEA761635} 26 | Win32Proj 27 | IOCPUDP 28 | 29 | 30 | 31 | Application 32 | true 33 | v143 34 | Unicode 35 | 36 | 37 | Application 38 | true 39 | v143 40 | Unicode 41 | 42 | 43 | Application 44 | false 45 | v143 46 | true 47 | Unicode 48 | 49 | 50 | Application 51 | false 52 | v143 53 | true 54 | Unicode 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | true 74 | 75 | 76 | true 77 | 78 | 79 | false 80 | 81 | 82 | false 83 | 84 | 85 | 86 | Use 87 | Level3 88 | Disabled 89 | _WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 90 | 91 | 92 | Console 93 | true 94 | 95 | 96 | 97 | 98 | Use 99 | Level3 100 | Disabled 101 | _WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 102 | 4312 103 | 104 | 105 | Console 106 | true 107 | 108 | 109 | 110 | 111 | Level3 112 | Use 113 | MaxSpeed 114 | true 115 | true 116 | _WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 117 | 118 | 119 | Console 120 | true 121 | true 122 | true 123 | 124 | 125 | 126 | 127 | Level3 128 | Use 129 | MaxSpeed 130 | true 131 | true 132 | _WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 133 | 4312 134 | 135 | 136 | Console 137 | true 138 | true 139 | true 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | Create 152 | Create 153 | Create 154 | Create 155 | 156 | 157 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /RIOIOCPUDP/RIOIOCPUDP.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | $(VCTargetsPath11) 23 | 24 | 25 | {568A728B-10DB-4684-9D42-534951ECEB09} 26 | Win32Proj 27 | RIOIOCPUDP 28 | 29 | 30 | 31 | Application 32 | true 33 | v143 34 | Unicode 35 | 36 | 37 | Application 38 | true 39 | v143 40 | Unicode 41 | 42 | 43 | Application 44 | false 45 | v143 46 | true 47 | Unicode 48 | 49 | 50 | Application 51 | false 52 | v143 53 | true 54 | Unicode 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | true 74 | 75 | 76 | true 77 | 78 | 79 | false 80 | 81 | 82 | false 83 | 84 | 85 | 86 | Use 87 | Level3 88 | Disabled 89 | _WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 90 | 91 | 92 | Console 93 | true 94 | 95 | 96 | 97 | 98 | Use 99 | Level3 100 | Disabled 101 | _WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 102 | 4312 103 | 104 | 105 | Console 106 | true 107 | 108 | 109 | 110 | 111 | Level3 112 | Use 113 | MaxSpeed 114 | true 115 | true 116 | _WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 117 | 118 | 119 | Console 120 | true 121 | true 122 | true 123 | 124 | 125 | 126 | 127 | Level3 128 | Use 129 | MaxSpeed 130 | true 131 | true 132 | _WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 133 | 4312 134 | 135 | 136 | Console 137 | true 138 | true 139 | true 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | Create 152 | Create 153 | Create 154 | Create 155 | 156 | 157 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /RIOIOCPUDPMT/RIOIOCPUDPMT.vcxproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Debug 10 | x64 11 | 12 | 13 | Release 14 | Win32 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | $(VCTargetsPath11) 23 | 24 | 25 | {53DAF978-9A3F-4FF7-9D62-3EB46F2FDD90} 26 | Win32Proj 27 | RIOIOCPUDPMT 28 | 29 | 30 | 31 | Application 32 | true 33 | v143 34 | Unicode 35 | 36 | 37 | Application 38 | true 39 | v143 40 | Unicode 41 | 42 | 43 | Application 44 | false 45 | v143 46 | true 47 | Unicode 48 | 49 | 50 | Application 51 | false 52 | v143 53 | true 54 | Unicode 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | true 74 | 75 | 76 | true 77 | 78 | 79 | false 80 | 81 | 82 | false 83 | 84 | 85 | 86 | Use 87 | Level3 88 | Disabled 89 | _WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 90 | 91 | 92 | Console 93 | true 94 | 95 | 96 | 97 | 98 | Use 99 | Level3 100 | Disabled 101 | _WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 102 | 4312 103 | 104 | 105 | Console 106 | true 107 | 108 | 109 | 110 | 111 | Level3 112 | Use 113 | MaxSpeed 114 | true 115 | true 116 | _WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 117 | 118 | 119 | Console 120 | true 121 | true 122 | true 123 | 124 | 125 | 126 | 127 | Level3 128 | Use 129 | MaxSpeed 130 | true 131 | true 132 | _WINSOCK_DEPRECATED_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 133 | 4312 134 | 135 | 136 | Console 137 | true 138 | true 139 | true 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | Create 152 | Create 153 | Create 154 | Create 155 | 156 | 157 | 158 | 159 | 160 | --------------------------------------------------------------------------------