summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cuda-sim/ptx-stats.cc9
-rw-r--r--src/cuda-sim/ptx-stats.h23
-rw-r--r--src/gpgpu-sim/gpu-sim.cc4
3 files changed, 21 insertions, 15 deletions
diff --git a/src/cuda-sim/ptx-stats.cc b/src/cuda-sim/ptx-stats.cc
index 0a9f08d..298729f 100644
--- a/src/cuda-sim/ptx-stats.cc
+++ b/src/cuda-sim/ptx-stats.cc
@@ -32,12 +32,9 @@
#include <stdio.h>
#include <map>
#include "../tr1_hash_map.h"
+#include "../../libcuda/gpgpu_context.h"
-// options
-bool enable_ptx_file_line_stats;
-char * ptx_line_stats_filename = NULL;
-
-void ptx_file_line_stats_options(option_parser_t opp)
+void ptx_stats::ptx_file_line_stats_options(option_parser_t opp)
{
option_parser_register(opp, "-enable_ptx_file_line_stats", OPT_BOOL,
&enable_ptx_file_line_stats,
@@ -118,7 +115,7 @@ typedef tr1_hash_map<ptx_file_line, ptx_file_line_stats, hash_ptx_file_line> ptx
static ptx_file_line_stats_map_t ptx_file_line_stats_tracker;
// output statistics to a file
-void ptx_file_line_stats_write_file()
+void ptx_stats::ptx_file_line_stats_write_file()
{
// check if stat collection is turned on
if (enable_ptx_file_line_stats == 0) return;
diff --git a/src/cuda-sim/ptx-stats.h b/src/cuda-sim/ptx-stats.h
index 4fc6599..c75fc58 100644
--- a/src/cuda-sim/ptx-stats.h
+++ b/src/cuda-sim/ptx-stats.h
@@ -29,13 +29,6 @@
#include "../option_parser.h"
-extern bool enable_ptx_file_line_stats;
-
-// set options
-void ptx_file_line_stats_options(option_parser_t opp);
-
-// output stats to a file
-void ptx_file_line_stats_write_file();
#ifdef __cplusplus
// stat collection interface to cuda-sim
@@ -56,3 +49,19 @@ void ptx_file_line_stats_commit_exposed_latency(int sc_id, int exposed_latency);
void ptx_file_line_stats_add_warp_divergence(unsigned pc, unsigned n_way_divergence);
+class gpgpu_context;
+class ptx_stats {
+ public:
+ ptx_stats(gpgpu_context* ctx) {
+ ptx_line_stats_filename = NULL;
+ gpgpu_ctx = ctx;
+ }
+ char * ptx_line_stats_filename;
+ bool enable_ptx_file_line_stats;
+ gpgpu_context* gpgpu_ctx;
+ // set options
+ void ptx_file_line_stats_options(option_parser_t opp);
+
+ // output stats to a file
+ void ptx_file_line_stats_write_file();
+};
diff --git a/src/gpgpu-sim/gpu-sim.cc b/src/gpgpu-sim/gpu-sim.cc
index 0644b44..bdf989a 100644
--- a/src/gpgpu-sim/gpu-sim.cc
+++ b/src/gpgpu-sim/gpu-sim.cc
@@ -545,7 +545,7 @@ void gpgpu_sim_config::reg_options(option_parser_t opp)
option_parser_register(opp, "-trace_sampling_memory_partition", OPT_INT32,
&Trace::sampling_memory_partition, "The memory partition which is printed using MEMPART_DPRINTF. Default -1 (i.e. all)",
"-1");
- ptx_file_line_stats_options(opp);
+ gpgpu_ctx->stats->ptx_file_line_stats_options(opp);
//Jin: kernel launch latency
option_parser_register(opp, "-gpgpu_kernel_launch_latency", OPT_INT32,
@@ -932,7 +932,7 @@ void gpgpu_sim::update_stats() {
void gpgpu_sim::print_stats()
{
- ptx_file_line_stats_write_file();
+ gpgpu_ctx->stats->ptx_file_line_stats_write_file();
gpu_print_stat();
if (g_network_mode) {