+// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2004 SuSE, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like. Any license provided herein, whether implied or
- * otherwise, applies only to this software file. Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- *
+ */
+
+/*
* aio-stress
*
* will open or create each file on the command line, and start a series
if (t->stage_mb_trans && t->num_files > 0) {
double seconds = time_since_now(&stage_time);
- fprintf(stderr, "thread %d %s totals (%.2f MB/s) %.2f MB in %.2fs\n",
- t - global_thread_info, this_stage, t->stage_mb_trans/seconds,
- t->stage_mb_trans, seconds);
+ fprintf(stderr, "thread %llu %s totals (%.2f MB/s) %.2f MB in %.2fs\n",
+ (unsigned long long)(t - global_thread_info), this_stage,
+ t->stage_mb_trans/seconds, t->stage_mb_trans, seconds);
}
if (num_threads > 1) {
int run_workers(struct thread_info *t, int num_threads)
{
int ret;
- int thread_ret;
int i;
for(i = 0 ; i < num_threads ; i++) {
}
}
for(i = 0 ; i < num_threads ; i++) {
- ret = pthread_join(t[i].tid, (void *)&thread_ret);
+ ret = pthread_join(t[i].tid, NULL);
if (ret) {
perror("pthread_join");
exit(1);
num_threads);
}
- t = malloc(num_threads * sizeof(*t));
+ t = calloc(num_threads, sizeof(*t));
if (!t) {
- perror("malloc");
+ perror("calloc");
exit(1);
}
global_thread_info = t;
if (file_size < num_contexts * context_offset) {
fprintf(stderr, "file size %Lu too small for %d contexts\n",
- file_size, num_contexts);
+ (unsigned long long)file_size, num_contexts);
exit(1);
}
- fprintf(stderr, "file size %LuMB, record size %luKB, depth %d, ios per iteration %d\n", file_size / (1024 * 1024), rec_len / 1024, depth, io_iter);
+ fprintf(stderr, "file size %LuMB, record size %luKB, depth %d, ios per iteration %d\n",
+ (unsigned long long)file_size / (1024 * 1024),
+ rec_len / 1024, depth, io_iter);
fprintf(stderr, "max io_submit %d, buffer alignment set to %luKB\n",
max_io_submit, (page_size_mask + 1)/1024);
fprintf(stderr, "threads %d files %d contexts %d context offset %LuMB verification %s\n",
num_threads, num_files, num_contexts,
- context_offset / (1024 * 1024), verify ? "on" : "off");
+ (unsigned long long)context_offset / (1024 * 1024),
+ verify ? "on" : "off");
/* open all the files and do any required setup for them */
for (i = optind ; i < ac ; i++) {
int thread_index;