global switch=-1

#begin probe
probe begin if (switch==-1) {
	printf("begin1 probed: %s\n", module_name());
}

probe begin if (switch==0) {
	log("begin2 probed");
}

#dwarf probe (return)
probe kernel.function("vfs_write").return if (switch == 1) {
	log("function return probed")
	switch = 0
}

#dwarf probe (entry)
probe kernel.function("vfs_write").return if (switch == 2) {
	log("function entry probed")
	switch = 0
}

#timer probe
probe timer.ms(100) if (switch == 3) {
	log("timer probed")
	switch = 0
}

#profile probe
probe timer.profile if (switch == 4) {
	log("profile probed")
	switch = 0
}

# aliasess
probe alias.one.a  = timer.ms(150) if (switch == 5) { print("alias.one.a and") }
probe alias.one.b  = timer.ms(200) if (switch == 6) { print("alias.one.b and") }
probe alias.one = alias.one.* if (switch >= 5 && switch < 7) { print(" alias.one and") }
probe alias.two = timer.ms(250) if (switch == 7) { print("alias.two and") }
probe alias.* if (switch) { log(" alias.* probed") }

probe procfs("switch").write {
	switch = strtol($value, 10)
	if (switch > 7) {
		exit()
	}
}

