From d3d0b38b90f14660ecb6243373daa921f8ae02b1 Mon Sep 17 00:00:00 2001 From: Tor Aamodt Date: Sat, 17 Jul 2010 10:29:05 -0800 Subject: integrating Wilson's bugfixes from release branch [git-p4: depot-paths = "//depot/gpgpu_sim_research/fermi/distribution/": change = 6869] --- src/cuda-sim/ptx-stats.cc | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/cuda-sim/ptx-stats.cc') diff --git a/src/cuda-sim/ptx-stats.cc b/src/cuda-sim/ptx-stats.cc index 2d18286..6e7e6ec 100644 --- a/src/cuda-sim/ptx-stats.cc +++ b/src/cuda-sim/ptx-stats.cc @@ -65,6 +65,7 @@ #include "../option_parser.h" #include #include +#include // external dependencies extern function_info *g_func_info; @@ -89,7 +90,7 @@ void ptx_file_line_stats_options(option_parser_t opp) class ptx_file_line { public: - ptx_file_line(const char* s, int l){ + ptx_file_line(const char* s, int l) { if( s == NULL ) st = "NULL_NAME"; else @@ -109,13 +110,21 @@ public: } bool operator==(const ptx_file_line &other) const { - return (st==other.st) and (line==other.line); + return (line==other.line) && (st==other.st); } std::string st; unsigned line; }; +struct hash_ptx_file_line +{ + std::size_t operator()(const ptx_file_line & pfline) const { + std::hash hash_line; + return hash_line(pfline.line); + } +}; + // holds all statistics collected for a singe PTX source line class ptx_file_line_stats { @@ -138,7 +147,8 @@ public: unsigned long long warp_divergence; // number of warp divergence occured at this instruction }; -static std::map ptx_file_line_stats_tracker; +typedef std::unordered_map ptx_file_line_stats_map_t; +static ptx_file_line_stats_map_t ptx_file_line_stats_tracker; // output statistics to a file void ptx_file_line_stats_write_file() @@ -146,7 +156,7 @@ void ptx_file_line_stats_write_file() // check if stat collection is turned on if (enable_ptx_file_line_stats == 0) return; - std::map::iterator it; + ptx_file_line_stats_map_t::iterator it; FILE * pfile; pfile = fopen(ptx_line_stats_filename, "w"); -- cgit v1.3