diff --git a/python/dune/codegen/sumfact/autotune.py b/python/dune/codegen/sumfact/autotune.py
index bbe00a78f4552932d29f4cc1a18c07c8384db78a..a7a3c10634f8e8ad50d17a9f919d68fae7ea9228 100644
--- a/python/dune/codegen/sumfact/autotune.py
+++ b/python/dune/codegen/sumfact/autotune.py
@@ -212,7 +212,7 @@ def generate_standalone_code_google_benchmark(sf, filename):
         f.write("\n\n")
         f.write("static void BM_sumfact_kernel(benchmark::State& state){\n")
 
-    write_setup_code(sf, filename, define_thetas=False)
+    opcounting = write_setup_code(sf, filename, define_thetas=False)
 
     additional_arguments = [i.split()[-1] for i in sf.interface.signature_args]
     additional_arguments = ', '.join(additional_arguments)
@@ -227,6 +227,7 @@ def generate_standalone_code_google_benchmark(sf, filename):
                       "\n",
                       "BENCHMARK_MAIN();"
                       ])
+    set_option("opcounter", opcounting)
 
 
 def generate_standalone_code(sf, filename):