7 static FLIST_HEAD(profile_list);
9 struct profile_ops *find_profile(const char *profile)
11 struct profile_ops *ops = NULL;
14 flist_for_each(n, &profile_list) {
15 ops = flist_entry(n, struct profile_ops, list);
16 if (!strcmp(profile, ops->name))
25 int load_profile(const char *profile)
27 struct profile_ops *ops;
29 dprint(FD_PROFILE, "loading profile '%s'\n", profile);
31 ops = find_profile(profile);
34 add_job_opts(ops->cmdline);
38 log_err("fio: profile '%s' not found\n", profile);
42 static int add_profile_options(struct profile_ops *ops)
51 o->prof_name = ops->name;
60 int register_profile(struct profile_ops *ops)
64 dprint(FD_PROFILE, "register profile '%s'\n", ops->name);
66 ret = add_profile_options(ops);
68 flist_add_tail(&ops->list, &profile_list);
69 add_opt_posval("profile", ops->name, ops->desc);
73 invalidate_profile_options(ops->name);
77 void unregister_profile(struct profile_ops *ops)
79 dprint(FD_PROFILE, "unregister profile '%s'\n", ops->name);
80 flist_del(&ops->list);
81 invalidate_profile_options(ops->name);
82 del_opt_posval("profile", ops->name);
85 void profile_add_hooks(struct thread_data *td)
87 struct profile_ops *ops;
92 ops = find_profile(exec_profile);
96 td->fill_io_u_off = ops->fill_io_u_off;
97 td->fill_io_u_size = ops->fill_io_u_size;