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, FIO_CLIENT_TYPE_CLI);
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);
97 td->prof_io_ops = *ops->io_ops;
98 td->flags |= TD_F_PROFILE_OPS;
102 int profile_td_init(struct thread_data *td)
104 struct prof_io_ops *ops = &td->prof_io_ops;
107 return ops->td_init(td);
112 void profile_td_exit(struct thread_data *td)
114 struct prof_io_ops *ops = &td->prof_io_ops;