Index: uspace/app/hbench/Makefile
===================================================================
--- uspace/app/hbench/Makefile	(revision e7f9a093b00a54747dbfa7e288153beb04d93009)
+++ uspace/app/hbench/Makefile	(revision d17cf8c8d11e7ff1d0ec369af3ba9a1d6addc90c)
@@ -36,6 +36,6 @@
 	benchlist.c \
 	csv.c \
+	env.c \
 	main.c \
-	params.c \
 	fs/dirread.c \
 	fs/fileread.c \
Index: uspace/app/hbench/doc/doxygroups.h
===================================================================
--- uspace/app/hbench/doc/doxygroups.h	(revision e7f9a093b00a54747dbfa7e288153beb04d93009)
+++ uspace/app/hbench/doc/doxygroups.h	(revision d17cf8c8d11e7ff1d0ec369af3ba9a1d6addc90c)
@@ -19,5 +19,6 @@
  * benchmark function to the benchmark_t.
  *
- * The benchmarking function has to accept two arguments:
+ * The benchmarking function has to accept trhee arguments:
+ *  @li bench_env_t: benchmark environment configuration
  *  @li bench_run_t: call bench_run_start and bench_run_stop around the
  *      actual benchmarking code
@@ -27,5 +28,5 @@
  * Typically, the structure of the function is following:
  * @code{c}
- * static bool runner(bench_run_t *run, uint64_t size)
+ * static bool runnerconst bench_env_t const *envbench_run_t *run, uint64_t size)
  * {
  * 	bench_run_start(run);
Index: uspace/app/hbench/env.c
===================================================================
--- uspace/app/hbench/env.c	(revision d17cf8c8d11e7ff1d0ec369af3ba9a1d6addc90c)
+++ uspace/app/hbench/env.c	(revision d17cf8c8d11e7ff1d0ec369af3ba9a1d6addc90c)
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2019 Vojtech Horky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup hbench
+ * @{
+ */
+/**
+ * @file
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <str.h>
+#include "hbench.h"
+
+typedef struct {
+	ht_link_t link;
+
+	char *key;
+	char *value;
+} param_t;
+
+static size_t param_hash(const ht_link_t *item)
+{
+	param_t *param = hash_table_get_inst(item, param_t, link);
+	return str_size(param->key);
+}
+
+static size_t param_key_hash(void *key)
+{
+	char *key_str = key;
+	return str_size(key_str);
+}
+
+static bool param_key_equal(void *key, const ht_link_t *item)
+{
+	param_t *param = hash_table_get_inst(item, param_t, link);
+	char *key_str = key;
+
+	return str_cmp(param->key, key_str) == 0;
+}
+
+static bool param_equal(const ht_link_t *link_a, const ht_link_t *link_b)
+{
+	param_t *a = hash_table_get_inst(link_a, param_t, link);
+	param_t *b = hash_table_get_inst(link_b, param_t, link);
+
+	return str_cmp(a->key, b->key) == 0;
+}
+
+static void param_remove(ht_link_t *item)
+{
+	param_t *param = hash_table_get_inst(item, param_t, link);
+	free(param->key);
+	free(param->value);
+}
+
+static hash_table_ops_t param_hash_table_ops = {
+	.hash = param_hash,
+	.key_hash = param_key_hash,
+	.key_equal = param_key_equal,
+	.equal = param_equal,
+	.remove_callback = param_remove
+};
+
+extern errno_t bench_env_init(bench_env_t *env)
+{
+	bool ok = hash_table_create(&env->parameters, 0, 0, &param_hash_table_ops);
+	if (!ok) {
+		return ENOMEM;
+	}
+
+	return EOK;
+}
+
+extern void bench_env_cleanup(bench_env_t *env)
+{
+	hash_table_destroy(&env->parameters);
+}
+
+errno_t bench_env_param_set(bench_env_t *env, const char *key, const char *value)
+{
+	param_t *param = malloc(sizeof(param_t));
+	if (param == NULL) {
+		return ENOMEM;
+	}
+
+	param->key = str_dup(key);
+	param->value = str_dup(value);
+
+	if ((param->key == NULL) || (param->value == NULL)) {
+		free(param->key);
+		free(param->value);
+		free(param);
+
+		return ENOMEM;
+	}
+
+	hash_table_insert(&env->parameters, &param->link);
+
+	return EOK;
+}
+
+const char *bench_env_param_get(bench_env_t *env, const char *key, const char *default_value)
+{
+	ht_link_t *item = hash_table_find(&env->parameters, (char *) key);
+
+	if (item == NULL) {
+		return default_value;
+	}
+
+	param_t *param = hash_table_get_inst(item, param_t, link);
+	return param->value;
+}
+
+/** @}
+ */
Index: uspace/app/hbench/fs/dirread.c
===================================================================
--- uspace/app/hbench/fs/dirread.c	(revision e7f9a093b00a54747dbfa7e288153beb04d93009)
+++ uspace/app/hbench/fs/dirread.c	(revision d17cf8c8d11e7ff1d0ec369af3ba9a1d6addc90c)
@@ -44,7 +44,7 @@
  * that the corresponding blocks would be cached after first run.
  */
-static bool runner(bench_run_t *run, uint64_t size)
+static bool runner(bench_env_t *env, bench_run_t *run, uint64_t size)
 {
-	const char *path = bench_param_get("dirname", "/");
+	const char *path = bench_env_param_get(env, "dirname", "/");
 
 	bench_run_start(run);
Index: uspace/app/hbench/fs/fileread.c
===================================================================
--- uspace/app/hbench/fs/fileread.c	(revision e7f9a093b00a54747dbfa7e288153beb04d93009)
+++ uspace/app/hbench/fs/fileread.c	(revision d17cf8c8d11e7ff1d0ec369af3ba9a1d6addc90c)
@@ -45,7 +45,7 @@
  * corresponding blocks would be cached after first run.
  */
-static bool runner(bench_run_t *run, uint64_t size)
+static bool runner(bench_env_t *env, bench_run_t *run, uint64_t size)
 {
-	const char *path = bench_param_get("filename", "/data/web/helenos.png");
+	const char *path = bench_env_param_get(env, "filename", "/data/web/helenos.png");
 
 	char *buf = malloc(BUFFER_SIZE);
Index: uspace/app/hbench/hbench.h
===================================================================
--- uspace/app/hbench/hbench.h	(revision e7f9a093b00a54747dbfa7e288153beb04d93009)
+++ uspace/app/hbench/hbench.h	(revision d17cf8c8d11e7ff1d0ec369af3ba9a1d6addc90c)
@@ -37,4 +37,5 @@
 #define HBENCH_H_
 
+#include <adt/hash_table.h>
 #include <errno.h>
 #include <stdarg.h>
@@ -58,4 +59,23 @@
 	size_t error_buffer_size;
 } bench_run_t;
+
+/** Benchmark environment configuration.
+ *
+ * Use proper access functions when modifying data inside this structure.
+ */
+typedef struct {
+	hash_table_t parameters;
+} bench_env_t;
+
+typedef bool (*benchmark_entry_t)(bench_env_t *, bench_run_t *, uint64_t);
+typedef bool (*benchmark_helper_t)(bench_env_t *, bench_run_t *);
+
+typedef struct {
+	const char *name;
+	const char *desc;
+	benchmark_entry_t entry;
+	benchmark_helper_t setup;
+	benchmark_helper_t teardown;
+} benchmark_t;
 
 static inline void bench_run_init(bench_run_t *run, char *error_buffer,
@@ -87,15 +107,4 @@
 }
 
-typedef bool (*benchmark_entry_t)(bench_run_t *, uint64_t);
-typedef bool (*benchmark_helper_t)(bench_run_t *);
-
-typedef struct {
-	const char *name;
-	const char *desc;
-	benchmark_entry_t entry;
-	benchmark_helper_t setup;
-	benchmark_helper_t teardown;
-} benchmark_t;
-
 extern benchmark_t *benchmarks[];
 extern size_t benchmark_count;
@@ -105,8 +114,8 @@
 extern void csv_report_close(void);
 
-extern errno_t bench_param_init(void);
-extern errno_t bench_param_set(const char *, const char *);
-extern const char *bench_param_get(const char *, const char *);
-extern void bench_param_cleanup(void);
+extern errno_t bench_env_init(bench_env_t *);
+extern errno_t bench_env_param_set(bench_env_t *, const char *, const char *);
+extern const char *bench_env_param_get(bench_env_t *, const char *, const char *);
+extern void bench_env_cleanup(bench_env_t *);
 
 /* Put your benchmark descriptors here (and also to benchlist.c). */
Index: uspace/app/hbench/ipc/ns_ping.c
===================================================================
--- uspace/app/hbench/ipc/ns_ping.c	(revision e7f9a093b00a54747dbfa7e288153beb04d93009)
+++ uspace/app/hbench/ipc/ns_ping.c	(revision d17cf8c8d11e7ff1d0ec369af3ba9a1d6addc90c)
@@ -38,5 +38,5 @@
 #include "../hbench.h"
 
-static bool runner(bench_run_t *run, uint64_t niter)
+static bool runner(bench_env_t *env, bench_run_t *run, uint64_t niter)
 {
 	bench_run_start(run);
Index: uspace/app/hbench/ipc/ping_pong.c
===================================================================
--- uspace/app/hbench/ipc/ping_pong.c	(revision e7f9a093b00a54747dbfa7e288153beb04d93009)
+++ uspace/app/hbench/ipc/ping_pong.c	(revision d17cf8c8d11e7ff1d0ec369af3ba9a1d6addc90c)
@@ -40,5 +40,5 @@
 static ipc_test_t *test = NULL;
 
-static bool setup(bench_run_t *run)
+static bool setup(bench_env_t *env, bench_run_t *run)
 {
 	errno_t rc = ipc_test_create(&test);
@@ -52,5 +52,5 @@
 }
 
-static bool teardown(bench_run_t *run)
+static bool teardown(bench_env_t *env, bench_run_t *run)
 {
 	ipc_test_destroy(test);
@@ -58,5 +58,5 @@
 }
 
-static bool runner(bench_run_t *run, uint64_t niter)
+static bool runner(bench_env_t *env, bench_run_t *run, uint64_t niter)
 {
 	bench_run_start(run);
Index: uspace/app/hbench/main.c
===================================================================
--- uspace/app/hbench/main.c	(revision e7f9a093b00a54747dbfa7e288153beb04d93009)
+++ uspace/app/hbench/main.c	(revision d17cf8c8d11e7ff1d0ec369af3ba9a1d6addc90c)
@@ -148,5 +148,5 @@
 }
 
-static bool run_benchmark(benchmark_t *bench)
+static bool run_benchmark(bench_env_t *env, benchmark_t *bench)
 {
 	printf("Warm up and determine workload size...\n");
@@ -169,5 +169,5 @@
 
 	if (bench->setup != NULL) {
-		ret = bench->setup(&helper_run);
+		ret = bench->setup(env, &helper_run);
 		if (!ret) {
 			goto leave_error;
@@ -190,5 +190,5 @@
 		bench_run_init(&run, error_msg, MAX_ERROR_STR_LENGTH);
 
-		bool ok = bench->entry(&run, workload_size);
+		bool ok = bench->entry(env, &run, workload_size);
 		if (!ok) {
 			goto leave_error;
@@ -212,5 +212,5 @@
 		bench_run_init(&runs[i], error_msg, MAX_ERROR_STR_LENGTH);
 
-		bool ok = bench->entry(&runs[i], workload_size);
+		bool ok = bench->entry(env, &runs[i], workload_size);
 		if (!ok) {
 			free(runs);
@@ -233,5 +233,5 @@
 leave:
 	if (bench->teardown != NULL) {
-		bool ok = bench->teardown(&helper_run);
+		bool ok = bench->teardown(env, &helper_run);
 		if (!ok) {
 			printf("Error: %s\n", error_msg);
@@ -245,5 +245,5 @@
 }
 
-static int run_benchmarks(void)
+static int run_benchmarks(bench_env_t *env)
 {
 	unsigned int count_ok = 0;
@@ -256,5 +256,5 @@
 	for (size_t it = 0; it < benchmark_count; it++) {
 		printf("%s (%s)\n", benchmarks[it]->name, benchmarks[it]->desc);
-		if (run_benchmark(benchmarks[it])) {
+		if (run_benchmark(env, benchmarks[it])) {
 			count_ok++;
 			continue;
@@ -314,14 +314,15 @@
 }
 
-static void handle_param_arg(char *arg)
+static void handle_param_arg(bench_env_t *env, char *arg)
 {
 	char *value = NULL;
 	char *key = str_tok(arg, "=", &value);
-	bench_param_set(key, value);
+	bench_env_param_set(env, key, value);
 }
 
 int main(int argc, char *argv[])
 {
-	errno_t rc = bench_param_init();
+	bench_env_t bench_env;
+	errno_t rc = bench_env_init(&bench_env);
 	if (rc != EOK) {
 		fprintf(stderr, "Failed to initialize internal params structure: %s\n",
@@ -350,5 +351,5 @@
 			break;
 		case 'p':
-			handle_param_arg(optarg);
+			handle_param_arg(&bench_env, optarg);
 			break;
 		case -1:
@@ -378,5 +379,5 @@
 
 	if (str_cmp(benchmark, "*") == 0) {
-		exit_code = run_benchmarks();
+		exit_code = run_benchmarks(&bench_env);
 	} else {
 		bool benchmark_exists = false;
@@ -384,5 +385,5 @@
 			if (str_cmp(benchmark, benchmarks[i]->name) == 0) {
 				benchmark_exists = true;
-				exit_code = run_benchmark(benchmarks[i]) ? 0 : -1;
+				exit_code = run_benchmark(&bench_env, benchmarks[i]) ? 0 : -1;
 				break;
 			}
@@ -395,5 +396,5 @@
 
 	csv_report_close();
-	bench_param_cleanup();
+	bench_env_cleanup(&bench_env);
 
 	return exit_code;
Index: uspace/app/hbench/malloc/malloc1.c
===================================================================
--- uspace/app/hbench/malloc/malloc1.c	(revision e7f9a093b00a54747dbfa7e288153beb04d93009)
+++ uspace/app/hbench/malloc/malloc1.c	(revision d17cf8c8d11e7ff1d0ec369af3ba9a1d6addc90c)
@@ -36,5 +36,5 @@
 #include "../hbench.h"
 
-static bool runner(bench_run_t *run, uint64_t size)
+static bool runner(bench_env_t *env, bench_run_t *run, uint64_t size)
 {
 	bench_run_start(run);
Index: uspace/app/hbench/malloc/malloc2.c
===================================================================
--- uspace/app/hbench/malloc/malloc2.c	(revision e7f9a093b00a54747dbfa7e288153beb04d93009)
+++ uspace/app/hbench/malloc/malloc2.c	(revision d17cf8c8d11e7ff1d0ec369af3ba9a1d6addc90c)
@@ -35,5 +35,5 @@
 #include "../hbench.h"
 
-static bool runner(bench_run_t *run, uint64_t niter)
+static bool runner(bench_env_t *env, bench_run_t *run, uint64_t niter)
 {
 	bench_run_start(run);
Index: uspace/app/hbench/params.c
===================================================================
--- uspace/app/hbench/params.c	(revision e7f9a093b00a54747dbfa7e288153beb04d93009)
+++ 	(revision )
@@ -1,146 +1,0 @@
-/*
- * Copyright (c) 2019 Vojtech Horky
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * - Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * - Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * - The name of the author may not be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/** @addtogroup hbench
- * @{
- */
-/**
- * @file
- */
-
-#include <adt/hash_table.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <str.h>
-#include "hbench.h"
-
-typedef struct {
-	ht_link_t link;
-
-	char *key;
-	char *value;
-} param_t;
-
-static size_t param_hash(const ht_link_t *item)
-{
-	param_t *param = hash_table_get_inst(item, param_t, link);
-	return str_size(param->key);
-}
-
-static size_t param_key_hash(void *key)
-{
-	char *key_str = key;
-	return str_size(key_str);
-}
-
-static bool param_key_equal(void *key, const ht_link_t *item)
-{
-	param_t *param = hash_table_get_inst(item, param_t, link);
-	char *key_str = key;
-
-	return str_cmp(param->key, key_str) == 0;
-}
-
-static bool param_equal(const ht_link_t *link_a, const ht_link_t *link_b)
-{
-	param_t *a = hash_table_get_inst(link_a, param_t, link);
-	param_t *b = hash_table_get_inst(link_b, param_t, link);
-
-	return str_cmp(a->key, b->key) == 0;
-}
-
-static void param_remove(ht_link_t *item)
-{
-	param_t *param = hash_table_get_inst(item, param_t, link);
-	free(param->key);
-	free(param->value);
-}
-
-static hash_table_ops_t param_hash_table_ops = {
-	.hash = param_hash,
-	.key_hash = param_key_hash,
-	.key_equal = param_key_equal,
-	.equal = param_equal,
-	.remove_callback = param_remove
-};
-
-/** Table of extra parameters (of param_t). */
-static hash_table_t param_hash_table;
-
-extern errno_t bench_param_init(void)
-{
-	bool ok = hash_table_create(&param_hash_table, 0, 0, &param_hash_table_ops);
-	if (!ok) {
-		return ENOMEM;
-	}
-
-	return EOK;
-}
-
-extern void bench_param_cleanup(void)
-{
-	hash_table_destroy(&param_hash_table);
-}
-
-errno_t bench_param_set(const char *key, const char *value)
-{
-	param_t *param = malloc(sizeof(param_t));
-	if (param == NULL) {
-		return ENOMEM;
-	}
-
-	param->key = str_dup(key);
-	param->value = str_dup(value);
-
-	if ((param->key == NULL) || (param->value == NULL)) {
-		free(param->key);
-		free(param->value);
-		free(param);
-
-		return ENOMEM;
-	}
-
-	hash_table_insert(&param_hash_table, &param->link);
-
-	return EOK;
-}
-
-const char *bench_param_get(const char *key, const char *default_value)
-{
-	ht_link_t *item = hash_table_find(&param_hash_table, (char *) key);
-
-	if (item == NULL) {
-		return default_value;
-	}
-
-	param_t *param = hash_table_get_inst(item, param_t, link);
-	return param->value;
-}
-
-/** @}
- */
Index: uspace/app/hbench/synch/fibril_mutex.c
===================================================================
--- uspace/app/hbench/synch/fibril_mutex.c	(revision e7f9a093b00a54747dbfa7e288153beb04d93009)
+++ uspace/app/hbench/synch/fibril_mutex.c	(revision d17cf8c8d11e7ff1d0ec369af3ba9a1d6addc90c)
@@ -65,5 +65,5 @@
 }
 
-static bool runner(bench_run_t *run, uint64_t size)
+static bool runner(bench_env_t *env, bench_run_t *run, uint64_t size)
 {
 	shared_t shared;
