summaryrefslogtreecommitdiff
path: root/src/Main.cpp
diff options
context:
space:
mode:
authorTim Besard <tim.besard@gmail.com>2011-11-02 09:13:38 +0100
committerTim Besard <tim.besard@gmail.com>2011-11-02 09:13:38 +0100
commitc108197c20aa7b93849e383a3aaaf7b2bba30405 (patch)
treef05aa2ff019892dfc936ad2242d43373191f16cd /src/Main.cpp
parenteb6995fb5a0f4382cb4a01d301423e74ea8babe6 (diff)
Formatting the source.
Diffstat (limited to 'src/Main.cpp')
-rw-r--r--src/Main.cpp107
1 files changed, 52 insertions, 55 deletions
diff --git a/src/Main.cpp b/src/Main.cpp
index ebd276a..a4d68e4 100644
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -9,7 +9,6 @@
* Douglas M. Pase - initial API and implementation *
*******************************************************************************/
-
#include <stdio.h>
#include "Main.h"
@@ -20,70 +19,68 @@
#include "Output.h"
#include "Experiment.h"
- // This program allocates and accesses
- // a number of blocks of memory, one or more
- // for each thread that executes. Blocks
- // are divided into sub-blocks called
- // pages, and pages are divided into
- // sub-blocks called cache lines.
- //
- // All pages are collected into a list.
- // Pages are selected for the list in
- // a particular order. Each cache line
- // within the page is similarly gathered
- // into a list in a particular order.
- // In both cases the order may be random
- // or linear.
- //
- // A root pointer points to the first
- // cache line. A pointer in the cache
- // line points to the next cache line,
- // which contains a pointer to the cache
- // line after that, and so on. This
- // forms a pointer chain that touches all
- // cache lines within the first page,
- // then all cache lines within the second
- // page, and so on until all pages are
- // covered. The last pointer contains
- // NULL, terminating the chain.
- //
- // Depending on compile-time options,
- // pointers may be 32-bit or 64-bit
- // pointers.
+// This program allocates and accesses
+// a number of blocks of memory, one or more
+// for each thread that executes. Blocks
+// are divided into sub-blocks called
+// pages, and pages are divided into
+// sub-blocks called cache lines.
+//
+// All pages are collected into a list.
+// Pages are selected for the list in
+// a particular order. Each cache line
+// within the page is similarly gathered
+// into a list in a particular order.
+// In both cases the order may be random
+// or linear.
+//
+// A root pointer points to the first
+// cache line. A pointer in the cache
+// line points to the next cache line,
+// which contains a pointer to the cache
+// line after that, and so on. This
+// forms a pointer chain that touches all
+// cache lines within the first page,
+// then all cache lines within the second
+// page, and so on until all pages are
+// covered. The last pointer contains
+// NULL, terminating the chain.
+//
+// Depending on compile-time options,
+// pointers may be 32-bit or 64-bit
+// pointers.
int verbose = 0;
-int
-main( int argc, char* argv[] )
-{
- Timer::calibrate(10000);
- double clk_res = Timer::resolution();
+int main(int argc, char* argv[]) {
+ Timer::calibrate(10000);
+ double clk_res = Timer::resolution();
- Experiment e;
- if (e.parse_args(argc, argv)) {
- return 0;
- }
+ Experiment e;
+ if (e.parse_args(argc, argv)) {
+ return 0;
+ }
#if defined(UNDEFINED)
- e.print();
- if (argv != NULL) return 0;
+ e.print();
+ if (argv != NULL) return 0;
#endif
- SpinBarrier sb( e.num_threads );
- Run r[ e.num_threads ];
- for (int i=0; i < e.num_threads; i++) {
- r[i].set( e, &sb );
- r[i].start();
- }
+ SpinBarrier sb(e.num_threads);
+ Run r[e.num_threads];
+ for (int i = 0; i < e.num_threads; i++) {
+ r[i].set(e, &sb);
+ r[i].start();
+ }
- for (int i=0; i < e.num_threads; i++) {
- r[i].wait();
- }
+ for (int i = 0; i < e.num_threads; i++) {
+ r[i].wait();
+ }
- int64 ops = Run::ops_per_chain();
- double secs = Run::seconds();
+ int64 ops = Run::ops_per_chain();
+ double secs = Run::seconds();
- Output::print(e, ops, secs, clk_res);
+ Output::print(e, ops, secs, clk_res);
- return 0;
+ return 0;
}