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);
33 if (ops->prep_cmd()) {
34 log_err("fio: profile %s prep failed\n", profile);
37 add_job_opts(ops->cmdline, FIO_CLIENT_TYPE_CLI);
41 log_err("fio: profile '%s' not found\n", profile);
45 static int add_profile_options(struct profile_ops *ops)
54 o->prof_name = ops->name;
63 int register_profile(struct profile_ops *ops)
67 dprint(FD_PROFILE, "register profile '%s'\n", ops->name);
69 ret = add_profile_options(ops);
71 flist_add_tail(&ops->list, &profile_list);
72 add_opt_posval("profile", ops->name, ops->desc);
76 invalidate_profile_options(ops->name);
80 void unregister_profile(struct profile_ops *ops)
82 dprint(FD_PROFILE, "unregister profile '%s'\n", ops->name);
83 flist_del(&ops->list);
84 invalidate_profile_options(ops->name);
85 del_opt_posval("profile", ops->name);
88 void profile_add_hooks(struct thread_data *td)
90 struct profile_ops *ops;
95 ops = find_profile(exec_profile);
100 td->prof_io_ops = *ops->io_ops;
101 td->flags |= TD_F_PROFILE_OPS;
105 int profile_td_init(struct thread_data *td)
107 struct prof_io_ops *ops = &td->prof_io_ops;
110 return ops->td_init(td);
115 void profile_td_exit(struct thread_data *td)
117 struct prof_io_ops *ops = &td->prof_io_ops;