Permalink
Browse files

Merge branch 'master' into openbsd

Conflicts:
	Makefile
	mempipe_thr.c
	xutil.h
  • Loading branch information...
2 parents 2d45f6f + 7100532 commit 0f42a3eed4421f382445defec3afb0717ddbbbe0 @avsm committed Feb 1, 2012
Showing with 2,058 additions and 484 deletions.
  1. +6 −2 Makefile
  2. +38 −0 all_lat.sh
  3. +30 −7 all_thr.py
  4. +26 −0 core2core-all-notoptimal.sh
  5. +26 −0 core2core-all-optimal.sh
  6. +0 −2 mempipe_thr.c
  7. +3 −2 resolve/latency.r
  8. +82 −0 resolve/plot_ipi.py
  9. +79 −0 resolve/plot_lat.py
  10. +90 −49 resolve/plot_thr.py
  11. 0 {resolve → results}/results.thr.48native-repeated/01-mempipe_spin_thr-headline.log
  12. 0 {resolve → results}/results.thr.48native-repeated/01-mempipe_thr-headline.log
  13. 0 {resolve → results}/results.thr.48native-repeated/01-pipe_thr-headline.log
  14. 0 {resolve → results}/results.thr.48native-repeated/01-shmem_pipe_thr-headline.log
  15. 0 {resolve → results}/results.thr.48native-repeated/01-tcp_nodelay_thr-headline.log
  16. 0 {resolve → results}/results.thr.48native-repeated/01-tcp_thr-headline.log
  17. 0 {resolve → results}/results.thr.48native-repeated/01-unix_thr-headline.log
  18. 0 {resolve → results}/results.thr.48native-repeated/01-vmsplice_coop_pipe_thr-headline.log
  19. BIN {resolve → results}/results.thr.48native-repeated/01-vmsplice_coop_thr-headline.log
  20. 0 {resolve → results}/results.thr.48native-repeated/1/01-mempipe_thr-headline.log
  21. 0 {resolve → results}/results.thr.48native-repeated/1/01-pipe_thr-headline.log
  22. 0 {resolve → results}/results.thr.48native-repeated/1/01-shmem_pipe_thr-headline.log
  23. 0 {resolve → results}/results.thr.48native-repeated/1/01-tcp_nodelay_thr-headline.log
  24. 0 {resolve → results}/results.thr.48native-repeated/1/01-tcp_thr-headline.log
  25. 0 {resolve → results}/results.thr.48native-repeated/1/01-unix_thr-headline.log
  26. 0 {resolve → results}/results.thr.48native-repeated/1/01-vmsplice_coop_pipe_thr-headline.log
  27. 0 {resolve → results}/results.thr.48native-repeated/10/01-mempipe_thr-headline.log
  28. 0 {resolve → results}/results.thr.48native-repeated/10/01-pipe_thr-headline.log
  29. 0 {resolve → results}/results.thr.48native-repeated/10/01-shmem_pipe_thr-headline.log
  30. 0 {resolve → results}/results.thr.48native-repeated/10/01-tcp_nodelay_thr-headline.log
  31. 0 {resolve → results}/results.thr.48native-repeated/10/01-tcp_thr-headline.log
  32. 0 {resolve → results}/results.thr.48native-repeated/10/01-unix_thr-headline.log
  33. 0 {resolve → results}/results.thr.48native-repeated/10/01-vmsplice_coop_pipe_thr-headline.log
  34. 0 {resolve → results}/results.thr.48native-repeated/2/01-mempipe_thr-headline.log
  35. 0 {resolve → results}/results.thr.48native-repeated/2/01-pipe_thr-headline.log
  36. 0 {resolve → results}/results.thr.48native-repeated/2/01-shmem_pipe_thr-headline.log
  37. 0 {resolve → results}/results.thr.48native-repeated/2/01-tcp_nodelay_thr-headline.log
  38. 0 {resolve → results}/results.thr.48native-repeated/2/01-tcp_thr-headline.log
  39. 0 {resolve → results}/results.thr.48native-repeated/2/01-unix_thr-headline.log
  40. 0 {resolve → results}/results.thr.48native-repeated/2/01-vmsplice_coop_pipe_thr-headline.log
  41. 0 {resolve → results}/results.thr.48native-repeated/3/01-mempipe_thr-headline.log
  42. 0 {resolve → results}/results.thr.48native-repeated/3/01-pipe_thr-headline.log
  43. 0 {resolve → results}/results.thr.48native-repeated/3/01-shmem_pipe_thr-headline.log
  44. 0 {resolve → results}/results.thr.48native-repeated/3/01-tcp_nodelay_thr-headline.log
  45. 0 {resolve → results}/results.thr.48native-repeated/3/01-tcp_thr-headline.log
  46. 0 {resolve → results}/results.thr.48native-repeated/3/01-unix_thr-headline.log
  47. 0 {resolve → results}/results.thr.48native-repeated/3/01-vmsplice_coop_pipe_thr-headline.log
  48. 0 {resolve → results}/results.thr.48native-repeated/4/01-mempipe_thr-headline.log
  49. 0 {resolve → results}/results.thr.48native-repeated/4/01-pipe_thr-headline.log
  50. 0 {resolve → results}/results.thr.48native-repeated/4/01-shmem_pipe_thr-headline.log
  51. 0 {resolve → results}/results.thr.48native-repeated/4/01-tcp_nodelay_thr-headline.log
  52. 0 {resolve → results}/results.thr.48native-repeated/4/01-tcp_thr-headline.log
  53. 0 {resolve → results}/results.thr.48native-repeated/4/01-unix_thr-headline.log
  54. 0 {resolve → results}/results.thr.48native-repeated/4/01-vmsplice_coop_pipe_thr-headline.log
  55. 0 {resolve → results}/results.thr.48native-repeated/5/01-mempipe_thr-headline.log
  56. 0 {resolve → results}/results.thr.48native-repeated/5/01-pipe_thr-headline.log
  57. 0 {resolve → results}/results.thr.48native-repeated/5/01-shmem_pipe_thr-headline.log
  58. 0 {resolve → results}/results.thr.48native-repeated/5/01-tcp_nodelay_thr-headline.log
  59. 0 {resolve → results}/results.thr.48native-repeated/5/01-tcp_thr-headline.log
  60. 0 {resolve → results}/results.thr.48native-repeated/5/01-unix_thr-headline.log
  61. 0 {resolve → results}/results.thr.48native-repeated/5/01-vmsplice_coop_pipe_thr-headline.log
  62. 0 {resolve → results}/results.thr.48native-repeated/6/01-mempipe_thr-headline.log
  63. 0 {resolve → results}/results.thr.48native-repeated/6/01-pipe_thr-headline.log
  64. 0 {resolve → results}/results.thr.48native-repeated/6/01-shmem_pipe_thr-headline.log
  65. 0 {resolve → results}/results.thr.48native-repeated/6/01-tcp_nodelay_thr-headline.log
  66. 0 {resolve → results}/results.thr.48native-repeated/6/01-tcp_thr-headline.log
  67. 0 {resolve → results}/results.thr.48native-repeated/6/01-unix_thr-headline.log
  68. 0 {resolve → results}/results.thr.48native-repeated/6/01-vmsplice_coop_pipe_thr-headline.log
  69. 0 {resolve → results}/results.thr.48native-repeated/7/01-mempipe_thr-headline.log
  70. 0 {resolve → results}/results.thr.48native-repeated/7/01-pipe_thr-headline.log
  71. 0 {resolve → results}/results.thr.48native-repeated/7/01-shmem_pipe_thr-headline.log
  72. 0 {resolve → results}/results.thr.48native-repeated/7/01-tcp_nodelay_thr-headline.log
  73. 0 {resolve → results}/results.thr.48native-repeated/7/01-tcp_thr-headline.log
  74. 0 {resolve → results}/results.thr.48native-repeated/7/01-unix_thr-headline.log
  75. 0 {resolve → results}/results.thr.48native-repeated/7/01-vmsplice_coop_pipe_thr-headline.log
  76. 0 {resolve → results}/results.thr.48native-repeated/8/01-mempipe_thr-headline.log
  77. 0 {resolve → results}/results.thr.48native-repeated/8/01-pipe_thr-headline.log
  78. 0 {resolve → results}/results.thr.48native-repeated/8/01-shmem_pipe_thr-headline.log
  79. 0 {resolve → results}/results.thr.48native-repeated/8/01-tcp_nodelay_thr-headline.log
  80. 0 {resolve → results}/results.thr.48native-repeated/8/01-tcp_thr-headline.log
  81. 0 {resolve → results}/results.thr.48native-repeated/8/01-unix_thr-headline.log
  82. 0 {resolve → results}/results.thr.48native-repeated/8/01-vmsplice_coop_pipe_thr-headline.log
  83. 0 {resolve → results}/results.thr.48native-repeated/9/01-mempipe_thr-headline.log
  84. 0 {resolve → results}/results.thr.48native-repeated/9/01-pipe_thr-headline.log
  85. 0 {resolve → results}/results.thr.48native-repeated/9/01-shmem_pipe_thr-headline.log
  86. 0 {resolve → results}/results.thr.48native-repeated/9/01-tcp_nodelay_thr-headline.log
  87. 0 {resolve → results}/results.thr.48native-repeated/9/01-tcp_thr-headline.log
  88. 0 {resolve → results}/results.thr.48native-repeated/9/01-unix_thr-headline.log
  89. 0 {resolve → results}/results.thr.48native-repeated/9/01-vmsplice_coop_pipe_thr-headline.log
  90. 0 {resolve → results}/results.thr.48native-with-numa/01-mempipe_spin_thr-headline.log
  91. 0 {resolve → results}/results.thr.48native-with-numa/01-mempipe_thr-headline.log
  92. 0 {resolve → results}/results.thr.48native-with-numa/01-pipe_thr-headline.log
  93. 0 {resolve → results}/results.thr.48native-with-numa/01-shmem_pipe_thr-headline.log
  94. 0 {resolve → results}/results.thr.48native-with-numa/01-tcp_nodelay_thr-headline.log
  95. 0 {resolve → results}/results.thr.48native-with-numa/01-tcp_thr-headline.log
  96. 0 {resolve → results}/results.thr.48native-with-numa/01-unix_thr-headline.log
  97. 0 {resolve → results}/results.thr.48native-with-numa/01-vmsplice_coop_pipe_thr-headline.log
  98. 0 {resolve → results}/results.thr.48native/01-mempipe_spin_thr-headline.log
  99. 0 {resolve → results}/results.thr.48native/01-mempipe_thr-headline.log
  100. 0 {resolve → results}/results.thr.48native/01-pipe_thr-headline.log
  101. 0 {resolve → results}/results.thr.48native/01-shmem_pipe_thr-headline.log
  102. 0 {resolve → results}/results.thr.48native/01-tcp_nodelay_thr-headline.log
  103. 0 {resolve → results}/results.thr.48native/01-tcp_thr-headline.log
  104. 0 {resolve → results}/results.thr.48native/01-unix_thr-headline.log
  105. 0 {resolve → results}/results.thr.48native/01-vmsplice_coop_pipe_thr-headline.log
  106. 0 {resolve → results}/results.thr.48xennopin/01-mempipe_thr-headline.log
  107. 0 {resolve → results}/results.thr.48xennopin/01-pipe_thr-headline.log
  108. 0 {resolve → results}/results.thr.48xennopin/01-shmem_pipe_thr-headline.log
  109. 0 {resolve → results}/results.thr.48xennopin/01-tcp_nodelay_thr-headline.log
  110. 0 {resolve → results}/results.thr.48xennopin/01-tcp_thr-headline.log
  111. 0 {resolve → results}/results.thr.48xennopin/01-unix_thr-headline.log
  112. 0 {resolve → results}/results.thr.48xennopin/01-vmsplice_coop_pipe_thr-headline.log
  113. 0 {resolve → results}/results.thr.48xenpin/01-mempipe_thr-headline.log
  114. 0 {resolve → results}/results.thr.48xenpin/01-pipe_thr-headline.log
  115. 0 {resolve → results}/results.thr.48xenpin/01-shmem_pipe_thr-headline.log
  116. 0 {resolve → results}/results.thr.48xenpin/01-tcp_nodelay_thr-headline.log
  117. 0 {resolve → results}/results.thr.48xenpin/01-tcp_thr-headline.log
  118. 0 {resolve → results}/results.thr.48xenpin/01-unix_thr-headline.log
  119. 0 {resolve → results}/results.thr.48xenpin/01-vmsplice_coop_pipe_thr-headline.log
  120. 0 {resolve → results}/results.thr.crysis/01-mempipe_spin_thr-headline.log
  121. 0 {resolve → results}/results.thr.crysis/01-mempipe_thr-headline.log
  122. 0 {resolve → results}/results.thr.crysis/01-pipe_thr-headline.log
  123. 0 {resolve → results}/results.thr.crysis/01-shmem_pipe_thr-headline.log
  124. 0 {resolve → results}/results.thr.crysis/01-tcp_nodelay_thr-headline.log
  125. 0 {resolve → results}/results.thr.crysis/01-tcp_thr-headline.log
  126. 0 {resolve → results}/results.thr.crysis/01-unix_thr-headline.log
  127. 0 {resolve → results}/results.thr.crysis/01-vmsplice_coop_pipe_thr-headline.log
  128. 0 {resolve → results}/results.thr.numa-native/01-mempipe_spin_thr-headline.log
  129. 0 {resolve → results}/results.thr.numa-native/01-mempipe_thr-headline.log
  130. 0 {resolve → results}/results.thr.numa-native/01-shmem_pipe_thr-headline.log
  131. +240 −0 run.py
  132. +280 −0 stats.c
  133. +2 −276 summarise_tsc_counters.c
  134. +4 −0 tcp_lat.c
  135. +52 −0 web/processing/cron.sh
  136. +147 −0 web/processing/gen-details-page.py
  137. +84 −0 web/processing/gen-overview-entry.py
  138. +14 −0 web/processing/html_foot.tmpl
  139. +40 −0 web/processing/html_head.tmpl
  140. +4 −0 web/processing/html_results_foot.tmpl
  141. +26 −0 web/processing/html_results_head.tmpl
  142. +82 −0 web/processing/plot_ipi.py
  143. +73 −0 web/processing/plot_lat.py
  144. +323 −0 web/processing/plot_thr.py
  145. +16 −10 xen/mini-os/arch/x86/mm.c
  146. +12 −7 xen/mini-os/arch/x86/x86_64.S
  147. +15 −1 xen/mini-os/console/console.c
  148. +22 −12 xen/mini-os/console/xencons_ring.c
  149. +87 −4 xen/mini-os/events.c
  150. +28 −11 xen/mini-os/hypervisor.c
  151. +0 −2 xen/mini-os/include/hypervisor.h
  152. +9 −3 xen/mini-os/include/x86/os.h
  153. +0 −14 xen/mini-os/kernel.c
  154. +99 −69 xen/mini-os/latency/evtchn.c
  155. +0 −6 xen/mini-os/mm.c
  156. +0 −4 xen/mini-os/sched.c
  157. +16 −3 xutil.c
  158. +3 −0 xutil.h
View
@@ -10,6 +10,8 @@ ifeq ($(uname),Darwin)
all_target := darwin
endif
+CFLAGS = -g -Wall -O3 -D_GNU_SOURCE -DNDEBUG -std=gnu99
+LDLIBS+=-lm
.PHONY: all clean run
@@ -39,10 +41,10 @@ x-%:
all: $(TARGETS)
@ :
-%_lat: atomicio.o test.o xutil.o %_lat.o
+%_lat: atomicio.o test.o xutil.o %_lat.o stats.o
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^
-%_thr: atomicio.o test.o xutil.o %_thr.o
+%_thr: atomicio.o test.o xutil.o %_thr.o stats.o
$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^
tcp_nodelay_thr.o: tcp_thr.c
@@ -63,6 +65,8 @@ vmsplice_hugepages_coop_pipe_thr.o: vmsplice_pipe_thr.c
vmsplice_coop_pipe_thr.o: vmsplice_pipe_thr.c
$(CC) $(CFLAGS) $^ -c -DVMSPLICE_COOP -o $@
+summarise_tsc_counters: summarise_tsc_counters.o stats.o
+
clean:
rm -f *~ core *.o $(TARGETS)
View
@@ -0,0 +1,38 @@
+#!/usr/bin/env bash
+echo "hello"
+SIZES="128"
+COUNT=10000
+LAT_TESTS="pipe_lat tcp_lat unix_lat mempipe_lat tcp_nodelay_lat"
+TESTS="${LAT_TESTS}"
+
+MAX_COREID=$2
+echo "cores: ${MAX_COREID}"
+
+ODIR=$1
+rm -rf ${ODIR}
+mkdir -p ${ODIR}
+
+for SIZE in ${SIZES}; do
+for c1 in $(jot ${MAX_COREID}); do
+ for c2 in $(jot ${MAX_COREID}); do
+ echo ${c1} to ${c2}
+ for t in ${TESTS}; do
+ d="${ODIR}/${SIZE}/${c1}-${c2}-${t}"
+ mkdir -p ${d}
+ if [ ${c1} -eq ${c2} ]; then
+ count=100
+ else
+ count=${COUNT}
+ fi
+ ./${t} -t -s ${SIZE} -c ${count} -a ${c1} -b ${c2} -o ${d}
+
+ # post-processing
+ ofile=${ODIR}/${t}.csv
+ d="${ODIR}/${SIZE}/${c1}-${c2}-${t}/01-${t}-headline.log"
+ speed=`tail -1 ${d} | awk '{print $4}' | sed -e 's/s//g'`
+ echo -n "${speed} " >> ${ofile}
+ rm ${ODIR}/${SIZE}/${c1}-${c2}-${t}/01-${t}-raw_tsc.log
+ done
+ done
+done
+done
View
@@ -4,13 +4,14 @@
# Chunk sizes: 64, 4096, 65536
# Test types: pipe, unix, tcp, tcp-nodelay, vmsplice-coop, shmem-pipe, mempipe-futex, mempipe-spin
# The latter 3 tests are repeated with a "safe" form that has the writer copy the data from shared memory before verification
-# All tests use "sos22_memset" (rep stosq) to write buffers (data is the iteration count) and rep scasq to verify at the reader.
+# All tests use rep stosq to write buffers (data is the iteration count) and rep scasq to verify at the reader.
# All tests work in place so far as their underlying transport allows (so pipes involve 2 copies, vmsplice involves 1, rings involve 0).
# All tests will be repeated to test bandwidth between cores named on the command line: see below...
# Parameters for this script: 1st parameter is an output directory (will be created; all tests will be stored below this)
-# All following parameters must be integers denoting a core. If you supply [x,y,z] we will test 0-0, 0-x, 0-y, 0-z.
-# We omit the mempipe-spin 0-0 test as it's stupid.
+# All following parameters must be integers denoting a core followed by another denoting a numa node.
+# If you supply x y z w we will test 0-x allocating from node y, 0-z allocating from node w.
+# We omit the mempipe-spin 0-0 test if it would otherwise be run as it's stupid.
import sys
import errno
@@ -26,8 +27,19 @@
else:
raise
-target_cores = ["0"]
-target_cores.extend([str(int(x)) for x in sys.argv[2:]])
+if len(sys.argv) % 2 == 1:
+ raise Exception("Must specify an even number of integer arguments after the output directory")
+
+target_args = [str(int(x)) for x in sys.argv[2:]]
+
+target_cores = []
+next_core = None
+for s in target_args:
+ if next_core is None:
+ next_core = s
+ else:
+ target_cores.append((next_core, s))
+ next_core = None
chunk_repeats = [("64", "1000000"), ("4096", "1000000"), ("65536", "100000")]
@@ -38,15 +50,26 @@
("mempipe_spin_thr", True), ("mempipe_spin_thr", False),
("shmem_pipe_thr", True), ("shmem_pipe_thr", False)]
+tests_done = set()
+
for test, rip in test_rips:
for chunksize, repeats in chunk_repeats:
- for tcore in target_cores:
+ for (tcore, tnode) in target_cores:
if test == "mempipe_spin_thr" and tcore == "0":
continue
+ if test not in ("mempipe_thr", "mempipe_spin_thr", "shmem_pipe_thr"):
+ tnode = "-1" # The other tests don't care about NUMA nodes.
+
+ # This is to skip would-be repeats for the above mentioned tests that don't care about NUMA.
+ if (test, rip, chunksize, repeats, tcore, tnode) in tests_done:
+ continue
+
+ tests_done.add((test, rip, chunksize, repeats, tcore, tnode))
+
progname = "./%s" % test
- args = [progname, "-t", "-s", chunksize, "-c", repeats, "-a", "0", "-b", tcore, "-o", output_dir, "-w", "-v", "-m", "2"]
+ args = [progname, "-s", chunksize, "-c", repeats, "-a", "0", "-b", tcore, "-o", output_dir, "-w", "-v", "-m", "2", "-n", tnode]
# Last four args: write in place, do verify, produce using rep stosq
if rip:
args.append("-r")
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+SIZE="4096"
+COUNT=20000000
+TESTS="pipe_thr"
+
+ODIR="results.allthr.native.notopt"
+rm -rf ${ODIR}
+mkdir -p ${ODIR}
+
+for base in {0..7..1}; do
+ echo -n "${base}: "
+ for c in {0..2..1}; do
+ c1=$(((${base} * 6) + (${c} * 2)))
+ c2=$((47-${c1}))
+ echo -n "${c1}x${c2} "
+ for t in ${TESTS}; do
+ d="${ODIR}/${SIZE}/${c1}-${c2}-${t}"
+ mkdir -p ${d}
+ ./${t} -s ${SIZE} -c ${COUNT} -a ${c1} -b ${c2} -o ${d} -m 2 &
+ done
+ done
+ echo
+done
+
+wait
View
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+SIZE="4096"
+COUNT=20000000
+TESTS="pipe_thr"
+
+ODIR="results.allthr.native.opt"
+rm -rf ${ODIR}
+mkdir -p ${ODIR}
+
+for base in {0..7..1}; do
+ echo -n ${base}:
+ for c in {0..2..1}; do
+ c1=$(((${base} * 6) + (${c} * 2)))
+ c2=$((${c1}+1))
+ echo -n "${c1}x${c2} "
+ for t in ${TESTS}; do
+ d="${ODIR}/${SIZE}/${c1}-${c2}-${t}"
+ mkdir -p ${d}
+ ./${t} -s ${SIZE} -c ${COUNT} -a ${c1} -b ${c2} -o ${d} -m 2 &
+ done
+ done
+ echo
+done
+
+wait
View
@@ -363,8 +363,6 @@ void parent_finish(test_data* td) {
mh->size_and_flags = MH_FLAG_READY | MH_FLAG_STOP;
#ifdef USE_FUTEX
futex_wake(&mh->size_and_flags);
-#else
- errx(1, "do something non-futexy to sync with parent here");
#endif
/* Wait for child to acknowledge receipt of all messages */
View
@@ -1,4 +1,5 @@
library(gplots)
+library(RSvgDevice)
matrix.axes <- function(data) {
a <- ((1:48)-1) / 48
@@ -16,10 +17,10 @@ plot_grid <- function (arch, test) {
filled.contour(inp, zlim=r, plot.axes=matrix.axes(inp), nlevels=ncols, title=title(t))
}
-pdf(file="latency.pdf", paper="a4")
-par(mfrow=c(2,2))
for (arch in c("48native", "48xenpin", "48xennopin")) {
for (test in c("mempipe_lat", "pipe_lat", "unix_lat", "tcp_lat")) {
+ f <- sprintf("latency-%s-%s.pdf", arch, test)
+ pdf(file=f)
plot_grid(arch, test)
}
}
View
@@ -0,0 +1,82 @@
+import sys, os
+
+import numpy as np
+import numpy.random
+import matplotlib
+matplotlib.use('Agg')
+
+import matplotlib.pyplot as plt
+import matplotlib.cm as cm
+
+def get_data_raw(filename):
+ x, y, v = np.loadtxt(filename, usecols=(0,1,2), unpack=True)
+
+ x_tmp = []
+ y_tmp = []
+ v_tmp = []
+ retdata = {}
+ j = 0
+ for i in range(0, len(x)):
+ if x[i] == 0 and y[i] == 1:
+ # new series
+ if i > 0:
+ retdata[j] = [x_tmp, y_tmp, v_tmp]
+# print len(retdata[j][0])
+ j = j + 1
+ x_tmp = [x[i]]
+ y_tmp = [y[i]]
+ v_tmp = [v[i]]
+ else:
+ # continuing series
+ x_tmp.append(x[i])
+ y_tmp.append(y[i])
+ v_tmp.append(v[i])
+ print j
+ return retdata
+
+def get_data(filename):
+ data = np.loadtxt(filename)
+ return [data]
+
+# ---------------------------
+# Handle command line args
+
+if len(sys.argv) < 4:
+ print "usage: python plot_ipi.py <input file> <num cores> <title>"
+ sys.exit(0)
+
+input_file = sys.argv[1]
+max_core_id = int(sys.argv[2])
+title = str(sys.argv[3])
+
+datasets = get_data(input_file)
+
+i = 0
+fig = plt.figure(figsize=(4,3))
+for ds in datasets:
+# print ds
+# heatmap, xedges, yedges = np.histogram2d(ds[0], ds[1], bins=180, weights=ds[2])
+# extent = [xedges[0], xedges[-1], yedges[0], yedges[-1]]
+
+ plt.clf()
+# print "plotting " + str(k)
+# plt.hexbin(ds[0], ds[1], C=ds[2], gridsize=max_core_id, linewidths=1, cmap=cm.jet, bins=None)
+ plt.matshow(ds, fignum=0, vmin=1800, cmap="Greys")
+
+# plt.clf()
+# plt.imshow(heatmap, extent=extent)
+
+ # add some
+ plt.ylabel('Core ID')
+ plt.ylim(0, max_core_id)
+ plt.xlabel('Core ID')
+ plt.xlim(0, max_core_id)
+ plt.title(title)
+
+ cb = plt.colorbar()
+ cb.set_label('IPI latency in nanoseconds')
+
+ plt.savefig("ipi_run_" + str(i) + ".pdf", format="pdf", bbox_inches='tight')
+ plt.savefig("ipi_run_" + str(i) + ".png", format="png", bbox_inches='tight')
+
+ i = i + 1
View
@@ -0,0 +1,79 @@
+import sys, os
+
+import numpy as np
+import numpy.random
+import matplotlib
+matplotlib.use('Agg')
+
+import matplotlib.pyplot as plt
+import matplotlib.cm as cm
+import pylab
+
+def get_data(filename):
+ data = np.loadtxt(filename)
+
+ x_tmp = []
+ y_tmp = []
+ v_tmp = []
+ retdata = {}
+ for i in range(0, len(data)):
+ for j in range(0, len(data[i])):
+ x_tmp.append(i)
+ y_tmp.append(j)
+ v_tmp.append(data[i][j])
+
+ retdata = [x_tmp, y_tmp, v_tmp]
+ print len(retdata)
+ return retdata
+
+
+# ---------------------------
+# Handle command line args
+
+if len(sys.argv) < 2:
+ print "usage: python plot_lat.py <input file> <title> [fix-scale] [colourmap]"
+ sys.exit(0)
+
+input_file = sys.argv[1]
+
+fix_scale = 0
+if len(sys.argv) > 3:
+ fix_scale = int(sys.argv[3])
+
+if len(sys.argv) > 4:
+ colourmap = sys.argv[4]
+else:
+ colourmap = "Greys"
+
+raw_data = np.loadtxt(input_file)
+data = get_data(input_file)
+
+fig = plt.figure(figsize=(4,3))
+#f = pylab.Figure(figsize=(2,1.5))
+# print ds
+#heatmap, xedges, yedges = np.histogram2d(data[0], data[1], bins=48, weights=data[2])
+#extent = [xedges[0], xedges[-1], yedges[0], yedges[-1]]
+
+#plt.clf()
+#plt.hexbin(data[0], data[1], C=data[2], gridsize=40, linewidths=1, cmap=cm.jet, bins=None)
+
+#plt.clf()
+#plt.imshow(heatmap, extent=extent)
+
+if fix_scale != 0:
+ plt.matshow(raw_data, vmax=0.000006, vmin=0.000001, fignum=0, cmap=colourmap)
+else:
+ plt.matshow(raw_data, fignum=0, cmap=colourmap)
+
+# add some
+plt.ylabel('Core ID')
+plt.ylim(0, 48)
+plt.xlabel('Core ID')
+plt.xlim(0, 48)
+plt.title(sys.argv[2])
+
+cb = plt.colorbar(shrink=1.0, format='%.3e')
+cb.set_label('Latency in microseconds')
+
+plt.savefig("lat_" + sys.argv[1] + ".pdf", format="pdf", bbox_inches='tight')
+plt.savefig("lat_" + sys.argv[1] + ".png", format="png", bbox_inches='tight')
Oops, something went wrong.

0 comments on commit 0f42a3e

Please sign in to comment.