Skip to content

Commit 8fd229d

Browse files
committed
Iinitial commit
1 parent 4ef75a0 commit 8fd229d

File tree

11 files changed

+1870
-2
lines changed

11 files changed

+1870
-2
lines changed

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
Copyright (c) 2015 Microsoft Corporation
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy
5+
of this software and associated documentation files (the "Software"), to deal
6+
in the Software without restriction, including without limitation the rights
7+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the Software is
9+
furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in all
12+
copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
SOFTWARE.

README.md

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,62 @@
1-
# ntttcp-for-linux
2-
A Linux network throughput benchmark tool. This tool should be able to interop with Windows version of NTTTCP.
1+
# NTTTCP-for-Linux
2+
3+
## Summary
4+
5+
A Linux network throughput performance benchmark tool.
6+
7+
## Getting Started
8+
9+
10+
### Building NTTTCP-for-Linux ###
11+
12+
make; make install
13+
14+
### Usage
15+
16+
ntttcp -h
17+
18+
### Known issues
19+
20+
* One extra TCP connection created on receiver side: this connection is reserved for sender-receiver synch purpose.
21+
22+
# Related topics
23+
24+
1. [NTTTCP](https://gallery.technet.microsoft.com/NTttcp-Version-528-Now-f8b12769)
25+
26+
2. [Microsoft Server & Cloud Blog](http://blogs.technet.com/b/server-cloud/)
27+
28+
3. [HyperV Linux Integrated Services Test](https://github.com/LIS/lis-test)
29+
30+
31+
## Terms of Use
32+
33+
By downloading and running this project, you agree to the license terms of the third party application software, Microsoft products, and components to be installed.
34+
35+
The third party software and products are provided to you by third parties. You are responsible for reading and accepting the relevant license terms for all software that will be installed. Microsoft grants you no rights to third party software.
36+
37+
38+
## License
39+
40+
```
41+
The MIT License (MIT)
42+
43+
Copyright (c) 2015 Microsoft Corporation
44+
45+
Permission is hereby granted, free of charge, to any person obtaining a copy
46+
of this software and associated documentation files (the "Software"), to deal
47+
in the Software without restriction, including without limitation the rights
48+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
49+
copies of the Software, and to permit persons to whom the Software is
50+
furnished to do so, subject to the following conditions:
51+
52+
The above copyright notice and this permission notice shall be included in all
53+
copies or substantial portions of the Software.
54+
55+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
56+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
57+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
58+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
59+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
60+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
61+
SOFTWARE.
62+
```

src/Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
CC=gcc
2+
CFLAGS=-Wall -g
3+
CLIBS=-pthread
4+
OUT=ntttcp
5+
OBJS=ntttcp.o tcpstream.o util.o
6+
7+
$(OUT): ntttcp.o tcpstream.o util.o
8+
$(CC) $(CFLAGS) $(CLIBS) -o $(OUT) $(OBJS)
9+
ntttcp.o: ntttcp.c
10+
$(CC) $(CFLAGS) -c ntttcp.c -o ntttcp.o
11+
tcpstream.o: tcpstream.c
12+
$(CC) $(CFLAGS) -c tcpstream.c -o tcpstream.o
13+
14+
.PHONY: clean
15+
clean:
16+
rm -rf *.o $(OUT)
17+
18+
.PHONY: install
19+
install:
20+
cp $(OUT) /usr/bin
21+

src/const.h

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// ----------------------------------------------------------------------------------
2+
// Copyright (c) Microsoft. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
4+
// Author: Shihua (Simon) Xiao, [email protected]
5+
// ----------------------------------------------------------------------------------
6+
7+
#define TOOL_NAME "NTTTCP for Linux"
8+
#define TOOL_VERSION "1.0.0.0"
9+
#define AUTHOR_NAME "Shihua (Simon) Xiao, [email protected]"
10+
11+
#define TCP SOCK_STREAM
12+
#define UDP SOCK_DGRAM
13+
14+
/* default values */
15+
#define MAX_CONNECTIONS_PER_THREAD 512
16+
#define MAX_NUM_THREADS 512
17+
#define MAX_EPOLL_EVENTS 512
18+
#define MAX_NUM_TOTAL_CONNECTIONS MAX_NUM_THREADS * MAX_CONNECTIONS_PER_THREAD
19+
#define DEFAULT_NUM_THREADS 16
20+
#define DEFAULT_CONN_PER_THREAD 4
21+
#define DEFAULT_BASE_PORT 5001
22+
#define DEFAULT_RECV_BUFFER_SIZE 64 * 1024
23+
#define DEFAULT_SEND_BUFFER_SIZE 128 * 1024
24+
#define DEFAULT_TEST_DURATION 60
25+
26+
#define NO_ERROR 0
27+
#define ERROR_GENERAL -1000
28+
#define ERROR_ARGS -1001
29+
#define ERROR_MEMORY_ALLOC -1002
30+
#define ERROR_PTHREAD_CREATE -1003
31+
#define ERROR_LISTEN -1104
32+
#define ERROR_ACCEPT -1105
33+
#define ERROR_SELECT -1106
34+
#define ERROR_EPOLL -1107
35+
#define ERROR_NETWORK_READ -1108
36+
#define ERROR_NETWORK_WRITE -1109

src/logger.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// ----------------------------------------------------------------------------------
2+
// Copyright (c) Microsoft. All rights reserved.
3+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
4+
// Author: Shihua (Simon) Xiao, [email protected]
5+
// ----------------------------------------------------------------------------------
6+
7+
//include time.h when calling localtime()
8+
#define PRINT_LOG(x, y) { \
9+
time_t rawtime; \
10+
struct tm * timeinfo;\
11+
char buffer [80];\
12+
time ( &rawtime );\
13+
timeinfo = localtime ( &rawtime );\
14+
strftime ( buffer,80,"%H:%M:%S",timeinfo );\
15+
printf ( "%s %s: %s\n", buffer, x, y);\
16+
}
17+
18+
#define PRINT_LOG_FREE(x, y) { \
19+
PRINT_LOG(x, y) \
20+
free(y);\
21+
}
22+
23+
#define PRINT_INFO(y) { PRINT_LOG ("INFO", y) }
24+
#define PRINT_INFO_FREE(y) { PRINT_LOG_FREE ("INFO", y) }
25+
26+
#define PRINT_ERR(y) { PRINT_LOG ("ERR ", y) }
27+
#define PRINT_ERR_FREE(y) { PRINT_LOG_FREE ("ERR ", y) }
28+
29+
#define PRINT_DBG(y) { \
30+
if(test->verbose) { \
31+
PRINT_LOG ("DBG ", y) \
32+
} \
33+
}
34+
35+
#define PRINT_DBG_FREE(y) { \
36+
if(test->verbose) { \
37+
PRINT_LOG_FREE ("DBG ", y) \
38+
} \
39+
}

0 commit comments

Comments
 (0)