-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit daac7fd
Showing
15 changed files
with
834 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
*~ | ||
*.o | ||
COPYING | ||
INSTALL | ||
Makefile.in | ||
aclocal.m4 | ||
autom4te.cache | ||
autoscan-2.68.log | ||
compile | ||
config.* | ||
configure | ||
depcomp | ||
install-sh | ||
missing | ||
Makefile | ||
src/.deps | ||
src/qpi_stress | ||
stamp-h1 | ||
cscope* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
fangdingjun <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
2011-7-16: | ||
initial project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SUBDIRS = src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
2011-7-16 | ||
initial projects |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
1.overview | ||
|
||
this is a tool to test CPU's QPI channel: | ||
|
||
start a process A and bind to cpu0, then request a share memory | ||
start a process B and bind to cpu1, then attach to process A's share memory | ||
process A write to the share memory, process B read from then share memory via QPI channel | ||
process A read the process B's share memory via QPI channel | ||
|
||
procA procB | ||
|| || | ||
+------+ +--------+ | ||
|cpu0 | QPI channel | cpu1 | | ||
+------+ +--------+ | ||
|| || | ||
+-----+ +-----+ | ||
|memA | |memB | | ||
+-----+ +-----+ | ||
|
||
2. install | ||
unpack the source and enter the source directory, type | ||
./configure | ||
make | ||
make install | ||
|
||
3.usage | ||
type | ||
qpi_stress -h | ||
for help |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
aclocal && autoheader && autoconf && automake -a && ./configure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# -*- Autoconf -*- | ||
# Process this file with autoconf to produce a configure script. | ||
|
||
AC_PREREQ([2.68]) | ||
AC_INIT([qpi-stress], [0.1], [[email protected]]) | ||
AC_CONFIG_SRCDIR([src/worker.c]) | ||
AC_CONFIG_HEADERS([config.h]) | ||
AM_INIT_AUTOMAKE(1.0) | ||
|
||
# Checks for programs. | ||
AC_PROG_CC | ||
AM_PROG_CC_C_O | ||
|
||
# Checks for libraries. | ||
|
||
# Checks for header files. | ||
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/time.h unistd.h]) | ||
|
||
# Checks for typedefs, structures, and compiler characteristics. | ||
AC_TYPE_PID_T | ||
AC_TYPE_SIZE_T | ||
|
||
# Checks for library functions. | ||
AC_FUNC_FORK | ||
AC_CHECK_FUNCS([alarm gettimeofday memset]) | ||
AC_CONFIG_FILES([Makefile | ||
src/Makefile]) | ||
AC_OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
bin_PROGRAMS = qpi_stress | ||
qpi_stress_SOURCES = main.c cpu.c shm.c report.c worker.c | ||
qpi_stress_CFLAGS = -Wall -Werror -D_GNU_SOURCE | ||
qpi_stress_LDFLAGS = -lpthread |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Filename: cpu.c | ||
* Author: [email protected] | ||
* License: GPLv2 | ||
* Date: 2011-7-10 | ||
* | ||
*/ | ||
|
||
#include<stdio.h> | ||
#include<unistd.h> | ||
#include<sched.h> | ||
//#include "qpi.h" | ||
|
||
int bind_to_cpu(int cpunum) | ||
{ | ||
int num = sysconf(_SC_NPROCESSORS_CONF); | ||
int i; | ||
|
||
cpu_set_t mask; | ||
|
||
CPU_ZERO(&mask); | ||
CPU_SET(cpunum, &mask); | ||
|
||
if (sched_setaffinity(0, sizeof(mask), &mask) == -1) { | ||
perror("set cpu affinity failed"); | ||
return -1; | ||
} | ||
|
||
CPU_ZERO(&mask); | ||
if (sched_getaffinity(0, sizeof(mask), &mask) == -1) { | ||
perror("get cpu affinity failed"); | ||
return -1; | ||
} | ||
for (i = 0; i < num; i++) { | ||
if (CPU_ISSET(i, &mask)) { | ||
break; | ||
} | ||
} | ||
if (i != cpunum) { | ||
fprintf(stderr, | ||
"set cpu affinity failed: process not running on cpu %d\n", | ||
cpunum); | ||
return -1; | ||
} | ||
return 0; | ||
} | ||
|
Oops, something went wrong.