-static int load_profile(const char *profile)
-{
- struct thread_data *td, *td_parent;
- const char **o;
- int i, in_global = 1;
- char jobname[32];
-
- dprint(FD_PARSE, "loading profile %s\n", profile);
-
- for (i = 0; i < PROFILE_END; i++) {
- if (!strcmp(profile, profiles[i]))
- break;
- }
-
- if (i == PROFILE_END) {
- log_err("fio: unknown profile %s\n", profile);
- return 1;
- }
-
- o = fio_prof_strings[i];
- if (!o)
- return 0;
-
- i = 0;
- td_parent = td = NULL;
- while (o[i]) {
- if (!strncmp(o[i], "name", 4)) {
- in_global = 0;
- if (td)
- add_job(td, jobname, 0);
- td = NULL;
- sprintf(jobname, "%s", o[i] + 5);
- }
- if (in_global && !td_parent)
- td_parent = get_new_job(1, &def_thread);
- else if (!in_global && !td) {
- if (!td_parent)
- td_parent = &def_thread;
- td = get_new_job(0, td_parent);
- }
- if (in_global)
- fio_options_parse(td_parent, (char **) &o[i], 1);
- else
- fio_options_parse(td, (char **) &o[i], 1);
- i++;
- }
- if (td)
- add_job(td, jobname, 0);
- return 0;
-}
-