diff options
Diffstat (limited to 'hardinfo2/arch/common')
| -rw-r--r-- | hardinfo2/arch/common/blowfish.h | 2 | ||||
| -rw-r--r-- | hardinfo2/arch/common/cryptohash.h | 4 | ||||
| -rw-r--r-- | hardinfo2/arch/common/fft.h | 32 | ||||
| -rw-r--r-- | hardinfo2/arch/common/nqueens.h | 2 | ||||
| -rw-r--r-- | hardinfo2/arch/common/raytrace.h | 2 | 
5 files changed, 30 insertions, 12 deletions
| diff --git a/hardinfo2/arch/common/blowfish.h b/hardinfo2/arch/common/blowfish.h index 5fea2e22..333fb157 100644 --- a/hardinfo2/arch/common/blowfish.h +++ b/hardinfo2/arch/common/blowfish.h @@ -19,7 +19,7 @@  #include <blowfish.h>  static gpointer -parallel_blowfish(unsigned int start, unsigned int end, void *data, GTimer *timer) +parallel_blowfish(unsigned int start, unsigned int end, void *data, gint thread_number)  {      BLOWFISH_CTX ctx;      unsigned int i; diff --git a/hardinfo2/arch/common/cryptohash.h b/hardinfo2/arch/common/cryptohash.h index 9897bb6b..2c917c9b 100644 --- a/hardinfo2/arch/common/cryptohash.h +++ b/hardinfo2/arch/common/cryptohash.h @@ -39,12 +39,12 @@ static void inline sha1_step(char *data, glong srclen)      SHA1Final(checksum, &ctx);  } -static gpointer cryptohash_for(unsigned int start, unsigned int end, void *data, GTimer *timer) +static gpointer cryptohash_for(unsigned int start, unsigned int end, void *data, gint thread_number)  {      unsigned int i;      for (i = start; i <= end; i++) {  -        if (i % 2 == 0) { +        if (i & 1) {              md5_step(data, 65536);          } else {              sha1_step(data, 65536); diff --git a/hardinfo2/arch/common/fft.h b/hardinfo2/arch/common/fft.h index 62daa9fe..f1a0ced8 100644 --- a/hardinfo2/arch/common/fft.h +++ b/hardinfo2/arch/common/fft.h @@ -18,12 +18,14 @@  #include <fftbench.h> -static gpointer fft_for(unsigned int start, unsigned int end, void *data, GTimer *timer) +static gpointer fft_for(unsigned int start, unsigned int end, void *data, gint thread_number)  {      unsigned int i; +    FFTBench **benches = (FFTBench **)data; +    FFTBench *fftbench = (FFTBench *)(benches[thread_number]);      for (i = start; i <= end; i++) {  -        fft_bench_start(); +        fft_bench_run(fftbench);      }      return NULL; @@ -33,15 +35,31 @@ static void  benchmark_fft(void)  {      gdouble elapsed = 0; +    int n_cores, i; +    gchar *temp; +    FFTBench **benches;      shell_view_set_enabled(FALSE);      shell_status_update("Running FFT benchmark..."); -    fft_bench_init(); -    elapsed = benchmark_parallel_for(0, 4, fft_for, NULL); -    fft_bench_finish(); +    /* Pre-allocate all benchmarks */ +    temp = module_call_method("devices::getProcessorCount"); +    n_cores = temp ? atoi(temp) : 1; +    g_free(temp); +    benches = g_new0(FFTBench *, n_cores); +    for (i = 0; i < n_cores; i++) { +      benches[i] = fft_bench_new(); +    } +     +    /* Run the benchmark */ +    elapsed = benchmark_parallel_for(0, 4, fft_for, benches); +     +    /* Free up the memory */ +    for (i = 0; i < n_cores; i++) { +      fft_bench_free(benches[i]); +    } +    g_free(benches); +              bench_results[BENCHMARK_FFT] = elapsed;  } - - diff --git a/hardinfo2/arch/common/nqueens.h b/hardinfo2/arch/common/nqueens.h index 2a233722..6ad5b4fd 100644 --- a/hardinfo2/arch/common/nqueens.h +++ b/hardinfo2/arch/common/nqueens.h @@ -18,7 +18,7 @@  #include <nqueens.h> -static gpointer nqueens_for(unsigned int start, unsigned int end, void *data, GTimer *timer) +static gpointer nqueens_for(unsigned int start, unsigned int end, void *data, gint thread_number)  {      unsigned int i; diff --git a/hardinfo2/arch/common/raytrace.h b/hardinfo2/arch/common/raytrace.h index 7fdc5e21..fe2fda91 100644 --- a/hardinfo2/arch/common/raytrace.h +++ b/hardinfo2/arch/common/raytrace.h @@ -19,7 +19,7 @@  void fbench();	/* fbench.c */  static gpointer -parallel_raytrace(unsigned int start, unsigned int end, gpointer data) +parallel_raytrace(unsigned int start, unsigned int end, gpointer data, gint thread_number)  {      unsigned int i; | 
