python 2 & 3 compatibility
diff --git a/tools/pidpersec b/tools/pidpersec
index b4a7ffb..6a3ca8c 100755
--- a/tools/pidpersec
+++ b/tools/pidpersec
@@ -25,7 +25,7 @@
 S_COUNT = 1
 
 # header
-print "Tracing... Ctrl-C to end."
+print("Tracing... Ctrl-C to end.")
 
 # output
 last = 0
@@ -35,6 +35,6 @@
 	except KeyboardInterrupt:
 		pass; exit()
 
-	print "%s: PIDs/sec: %d" % (strftime("%H:%M:%S"),
-	    (stats[c_int(S_COUNT)].value - last))
+	print("%s: PIDs/sec: %d" % (strftime("%H:%M:%S"),
+	    (stats[c_int(S_COUNT)].value - last)))
 	last = stats[c_int(S_COUNT)].value
diff --git a/tools/syncsnoop b/tools/syncsnoop
index 25f1e8c..5490bcc 100755
--- a/tools/syncsnoop
+++ b/tools/syncsnoop
@@ -11,6 +11,7 @@
 #
 # 13-Aug-2015	Brendan Gregg	Created this.
 
+from __future__ import print_function
 from bpf import BPF
 import sys
 
@@ -24,13 +25,13 @@
 BPF.attach_kprobe(b.load_func("do_sync", BPF.KPROBE), "sys_sync")
 
 # header
-print "%-18s %s" % ("TIME(s)", "CALL")
+print("%-18s %s" % ("TIME(s)", "CALL"))
 
 # open trace pipe
 try:
 	trace = open("/sys/kernel/debug/tracing/trace_pipe", "r")
 except:
-	print >> sys.stderr, "ERROR: opening trace_pipe"
+	print("ERROR: opening trace_pipe", file=sys.stderr)
 	exit(1)
 
 # format output
@@ -43,4 +44,4 @@
 	prolog, time_s, colon, word = line.rsplit(" ", 3)
 	time_s = time_s[:-1]	# strip trailing ":"
 
-	print "%-18s %s" % (time_s, word)
+	print("%-18s %s" % (time_s, word))
diff --git a/tools/vfscount b/tools/vfscount
index 5fe3f9b..2f5002e 100755
--- a/tools/vfscount
+++ b/tools/vfscount
@@ -10,6 +10,7 @@
 #
 # 14-Aug-2015	Brendan Gregg	Created this.
 
+from __future__ import print_function
 from bpf import BPF
 from ctypes import c_ushort, c_int, c_ulonglong
 from time import sleep, strftime
@@ -23,7 +24,7 @@
 	try:
 		syms = open(symfile, "r")
 	except:
-		print >> stderr, "ERROR: reading " + symfile
+		print("ERROR: reading " + symfile, file=sys.stderr)
 		exit()
 	line = syms.readline()
 	for line in iter(syms):
@@ -39,7 +40,7 @@
 	start = -1
 	end = len(ksym_addrs)
 	while end != start + 1:
-		mid = (start + end) / 2
+		mid = int((start + end) / 2)
 		if addr < ksym_addrs[mid]:
 			end = mid
 		else:
@@ -60,7 +61,7 @@
 counts = b.get_table("counts")
 
 # header
-print "Tracing... Ctrl-C to end."
+print("Tracing... Ctrl-C to end.")
 
 # output
 try:
@@ -68,6 +69,6 @@
 except KeyboardInterrupt:
 	pass
 
-print "\n%-16s %-12s %8s" % ("ADDR", "FUNC", "COUNT")
+print("\n%-16s %-12s %8s" % ("ADDR", "FUNC", "COUNT"))
 for k, v in sorted(counts.items(), key=lambda counts: counts[1].value):
-	print "%-16x %-12s %8d" % (k.ip, ksym(k.ip), v.value)
+	print("%-16x %-12s %8d" % (k.ip, ksym(k.ip), v.value))