Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace {u,}int_least64_t with {u,}int64_t #6239

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/docs/release.dox
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ changes:
is deprecated in offline traces where it is replaced by
#dynamorio::drmemtrace::TRACE_TYPE_INSTR_TAKEN_JUMP and
#dynamorio::drmemtrace::TRACE_TYPE_INSTR_UNTAKEN_JUMP.
- All int_least64_t and uint_least64_t types in drcachesim were replaced with
their precise counterparts int64_t and uint64_t.

Further non-compatibility-affecting changes include:
- Added new drmemtrace option -L0_filter_until_instrs which enables filtering
Expand Down
4 changes: 2 additions & 2 deletions clients/drcachesim/common/memref.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ namespace drmemtrace { /**< DrMemtrace tracing + simulation infrastructure names

// On some platforms, like MacOS, a thread id is 64 bits.
// We just make both 64 bits to cover all our bases.
typedef int_least64_t memref_pid_t; /**< Process id type. */
typedef int_least64_t memref_tid_t; /**< Thread id type. */
typedef int64_t memref_pid_t; /**< Process id type. */
typedef int64_t memref_tid_t; /**< Thread id type. */

/** A trace entry representing a data load, store, or prefetch. */
struct _memref_data_t {
Expand Down
2 changes: 1 addition & 1 deletion clients/drcachesim/simulator/cache_simulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ cache_simulator_t::print_results()

// All valid metrics are returned as a positive number.
// Negative return value is an error and is of type stats_error_t.
int_least64_t
int64_t
cache_simulator_t::get_cache_metric(metric_name_t metric, unsigned level, unsigned core,
cache_split_t split) const
{
Expand Down
2 changes: 1 addition & 1 deletion clients/drcachesim/simulator/cache_simulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class cache_simulator_t : public simulator_t {
bool
print_results() override;

int_least64_t
int64_t
get_cache_metric(metric_name_t metric, unsigned level, unsigned core = 0,
cache_split_t split = cache_split_t::DATA) const;

Expand Down
6 changes: 3 additions & 3 deletions clients/drcachesim/simulator/cache_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ class cache_stats_t : public caching_device_stats_t {

// A CPU cache handles flushes and prefetching requests
// as well as regular memory accesses.
int_least64_t num_flushes_;
int_least64_t num_prefetch_hits_;
int_least64_t num_prefetch_misses_;
int64_t num_flushes_;
int64_t num_prefetch_hits_;
int64_t num_prefetch_misses_;
};

} // namespace drmemtrace
Expand Down
4 changes: 2 additions & 2 deletions clients/drcachesim/simulator/caching_device_block.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ class caching_device_block_t {

addr_t tag_;

// XXX: using int_least64_t here results in a ~4% slowdown for 32-bit apps.
// XXX: using int64_t here results in a ~4% slowdown for 32-bit apps.
// A 32-bit counter should be sufficient but we may want to revisit.
// We already have stdint.h so we can reinstate int_least64_t easily.
// We already have stdint.h so we can reinstate int64_t easily.
int counter_; // for use by replacement policies
};

Expand Down
22 changes: 11 additions & 11 deletions clients/drcachesim/simulator/caching_device_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class caching_device_stats_t {
virtual void
invalidate(invalidation_type_t invalidation_type);

int_least64_t
int64_t
get_metric(metric_name_t metric) const
{
if (stats_map_.find(metric) != stats_map_.end()) {
Expand Down Expand Up @@ -232,19 +232,19 @@ class caching_device_stats_t {
void
check_compulsory_miss(addr_t addr);

int_least64_t num_hits_;
int_least64_t num_misses_;
int_least64_t num_compulsory_misses_;
int_least64_t num_child_hits_;
int64_t num_hits_;
int64_t num_misses_;
int64_t num_compulsory_misses_;
int64_t num_child_hits_;

int_least64_t num_inclusive_invalidates_;
int_least64_t num_coherence_invalidates_;
int64_t num_inclusive_invalidates_;
int64_t num_coherence_invalidates_;

// Stats saved when the last reset was called. This helps us get insight
// into what the stats were when the cache was warmed up.
int_least64_t num_hits_at_reset_;
int_least64_t num_misses_at_reset_;
int_least64_t num_child_hits_at_reset_;
int64_t num_hits_at_reset_;
int64_t num_misses_at_reset_;
int64_t num_child_hits_at_reset_;
// Enabled if options warmup_refs > 0 || warmup_fraction > 0
bool warmup_enabled_;

Expand All @@ -253,7 +253,7 @@ class caching_device_stats_t {

// References to the properties with statistics are held in the map with the
// statistic name as the key. Sample map element: {HITS, num_hits_}
std::map<metric_name_t, int_least64_t &> stats_map_;
std::map<metric_name_t, int64_t &> stats_map_;

// We provide a feature of dumping misses to a file.
bool dump_misses_;
Expand Down
6 changes: 3 additions & 3 deletions clients/drcachesim/simulator/snoop_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ class snoop_filter_t {
std::unordered_map<addr_t, coherence_table_entry_t> coherence_table_;
cache_t **caches_;
int num_snooped_caches_;
int_least64_t num_writes_;
int_least64_t num_writebacks_;
int_least64_t num_invalidates_;
int64_t num_writes_;
int64_t num_writebacks_;
int64_t num_invalidates_;
};

} // namespace drmemtrace
Expand Down
6 changes: 3 additions & 3 deletions clients/drcachesim/tests/drcachesim_unit_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,9 @@ generate_1D_accesses(cache_t &cache, addr_t start_address, int step_size, int st

// Helper code to grab a snapshot of cache stats.
struct cache_stats_snapshot_t {
int_least64_t hits;
int_least64_t misses;
int_least64_t child_hits;
int64_t hits;
int64_t misses;
int64_t child_hits;
};

static cache_stats_snapshot_t
Expand Down
10 changes: 5 additions & 5 deletions clients/drcachesim/tests/reuse_distance_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ print_histogram_empty_test()
reuse_distance_test_t reuse_distance(knobs);

// Create an empty histogram vector and distance histogram.
std::vector<std::pair<int_least64_t, int_least64_t>> sorted;
std::vector<std::pair<int64_t, int64_t>> sorted;
reuse_distance_t::distance_histogram_t distance_map_data;

// Make sure print_histogram handles this case without crashing.
Expand All @@ -336,13 +336,13 @@ print_histogram_mult_1p0_test()
reuse_distance_test_t reuse_distance(knobs);

// Fill in a sorted histogram vector.
std::vector<std::pair<int_least64_t, int_least64_t>> sorted;
std::vector<std::pair<int64_t, int64_t>> sorted;
// Also put some matching entries in a data histogram.
reuse_distance_t::distance_histogram_t distance_map_data;

constexpr int N = 100;

int_least64_t count = 0;
int64_t count = 0;
for (int i = 0; i < N; ++i) {
sorted.emplace_back(i, 1);
count += sorted.back().second;
Expand Down Expand Up @@ -381,12 +381,12 @@ print_histogram_mult_1p2_test()
reuse_distance_test_t reuse_distance(knobs);

// Fill in a sorted histogram vector.
std::vector<std::pair<int_least64_t, int_least64_t>> sorted;
std::vector<std::pair<int64_t, int64_t>> sorted;
reuse_distance_t::distance_histogram_t distance_map_data;

constexpr int N = 100;

int_least64_t count = 0;
int64_t count = 0;
for (int i = 0; i < N; ++i) {
sorted.emplace_back(i, 2);
count += sorted.back().second;
Expand Down
2 changes: 1 addition & 1 deletion clients/drcachesim/tools/basic_counts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ basic_counts_t::cmp_threads(const std::pair<memref_tid_t, per_shard_t *> &l,
}

void
basic_counts_t::print_counters(const counters_t &counters, int_least64_t num_threads,
basic_counts_t::print_counters(const counters_t &counters, int64_t num_threads,
const std::string &prefix, bool for_kernel_trace)
{
std::cerr << std::setw(12) << counters.instrs << prefix
Expand Down
42 changes: 21 additions & 21 deletions clients/drcachesim/tools/basic_counts.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,35 +158,35 @@ class basic_counts_t : public analysis_tool_t {
dcache_flushes == rhs.dcache_flushes && encodings == rhs.encodings &&
unique_pc_addrs == rhs.unique_pc_addrs;
}
int_least64_t instrs = 0;
int_least64_t instrs_nofetch = 0;
int_least64_t user_instrs = 0;
int_least64_t kernel_instrs = 0;
int_least64_t prefetches = 0;
int_least64_t loads = 0;
int_least64_t stores = 0;
int_least64_t sched_markers = 0;
int_least64_t xfer_markers = 0;
int_least64_t func_id_markers = 0;
int_least64_t func_retaddr_markers = 0;
int_least64_t func_arg_markers = 0;
int_least64_t func_retval_markers = 0;
int_least64_t phys_addr_markers = 0;
int_least64_t phys_unavail_markers = 0;
int64_t instrs = 0;
int64_t instrs_nofetch = 0;
int64_t user_instrs = 0;
int64_t kernel_instrs = 0;
int64_t prefetches = 0;
int64_t loads = 0;
int64_t stores = 0;
int64_t sched_markers = 0;
int64_t xfer_markers = 0;
int64_t func_id_markers = 0;
int64_t func_retaddr_markers = 0;
int64_t func_arg_markers = 0;
int64_t func_retval_markers = 0;
int64_t phys_addr_markers = 0;
int64_t phys_unavail_markers = 0;
// XXX i#5490: Add a counter for indirect branch target markers?
int_least64_t other_markers = 0;
int_least64_t icache_flushes = 0;
int_least64_t dcache_flushes = 0;
int64_t other_markers = 0;
int64_t icache_flushes = 0;
int64_t dcache_flushes = 0;
// The encoding entries aren't exposed at the memref_t level, but
// we use encoding_is_new as a proxy.
int_least64_t encodings = 0;
int64_t encodings = 0;
std::unordered_set<uint64_t> unique_pc_addrs;

// Metadata for the counts. These are not used for the equality, increment,
// or decrement operation, and must be set explicitly.

// Count of shards that were combined to produce the above counts.
int_least64_t shard_count = 1;
int64_t shard_count = 1;

// Stops tracking unique_pc_addrs. Tracking unique_pc_addrs can be very
// memory intensive. We skip it for interval state snapshots.
Expand Down Expand Up @@ -244,7 +244,7 @@ class basic_counts_t : public analysis_tool_t {
cmp_threads(const std::pair<memref_tid_t, per_shard_t *> &l,
const std::pair<memref_tid_t, per_shard_t *> &r);
static void
print_counters(const counters_t &counters, int_least64_t num_threads,
print_counters(const counters_t &counters, int64_t num_threads,
const std::string &prefix, bool for_kernel_trace = false);
void
compute_shard_interval_result(per_shard_t *shard, uint64_t interval_id);
Expand Down
4 changes: 2 additions & 2 deletions clients/drcachesim/tools/func_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class func_view_t : public analysis_tool_t {
num_returns += rhs.num_returns;
return *this;
}
int_least64_t num_calls = 0;
int_least64_t num_returns = 0;
int64_t num_calls = 0;
int64_t num_returns = 0;
// TODO i#4083: Record the arg and retval distributions.
};
struct shard_data_t {
Expand Down
6 changes: 3 additions & 3 deletions clients/drcachesim/tools/opcode_mix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ opcode_mix_t::process_memref(const memref_t &memref)
}

static bool
cmp_val(const std::pair<int, int_least64_t> &l, const std::pair<int, int_least64_t> &r)
cmp_val(const std::pair<int, int64_t> &l, const std::pair<int, int64_t> &r)
{
return (l.second > r.second);
}
Expand All @@ -255,8 +255,8 @@ opcode_mix_t::print_results()
}
std::cerr << TOOL_NAME << " results:\n";
std::cerr << std::setw(15) << total.instr_count << " : total executed instructions\n";
std::vector<std::pair<int, int_least64_t>> sorted(total.opcode_counts.begin(),
total.opcode_counts.end());
std::vector<std::pair<int, int64_t>> sorted(total.opcode_counts.begin(),
total.opcode_counts.end());
std::sort(sorted.begin(), sorted.end(), cmp_val);
for (const auto &keyvals : sorted) {
std::cerr << std::setw(15) << keyvals.second << " : " << std::setw(9)
Expand Down
4 changes: 2 additions & 2 deletions clients/drcachesim/tools/opcode_mix.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ class opcode_mix_t : public analysis_tool_t {
{
}
worker_data_t *worker;
int_least64_t instr_count;
std::unordered_map<int, int_least64_t> opcode_counts;
int64_t instr_count;
std::unordered_map<int, int64_t> opcode_counts;
std::string error;
app_pc last_trace_module_start;
size_t last_trace_module_size;
Expand Down
26 changes: 13 additions & 13 deletions clients/drcachesim/tools/reuse_distance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ reuse_distance_t::parallel_shard_memref(void *shard_data, const memref_t &memref
delete ref;
}
} else {
int_least64_t dist = shard->ref_list->move_to_front(it->second);
int64_t dist = shard->ref_list->move_to_front(it->second);
auto &dist_map = is_instr_type ? shard->dist_map : shard->dist_map_data;
distance_histogram_t::iterator dist_it = dist_map.find(dist);
if (dist_it == dist_map.end())
Expand Down Expand Up @@ -257,15 +257,15 @@ reuse_distance_t::print_shard_results(const shard_data_t *shard)
std::cerr.setf(std::ios::fixed);

double sum = 0.0;
int_least64_t count = 0;
int64_t count = 0;
for (const auto &it : shard->dist_map) {
sum += it.first * it.second;
count += it.second;
}
double mean = sum / count;
std::cerr << "Reuse distance mean: " << mean << "\n";
double sum_of_squares = 0;
int_least64_t recount = 0;
int64_t recount = 0;
bool have_median = false;
std::vector<distance_map_pair_t> sorted(shard->dist_map.size());
std::partial_sort_copy(shard->dist_map.begin(), shard->dist_map.end(), sorted.begin(),
Expand Down Expand Up @@ -331,7 +331,7 @@ reuse_distance_t::print_shard_results(const shard_data_t *shard)
}

void
reuse_distance_t::print_histogram(std::ostream &out, int_least64_t total_count,
reuse_distance_t::print_histogram(std::ostream &out, int64_t total_count,
const std::vector<distance_map_pair_t> &sorted,
const distance_histogram_t &dist_map_data)
{
Expand All @@ -353,20 +353,20 @@ reuse_distance_t::print_histogram(std::ostream &out, int_least64_t total_count,
out << std::setw(12) << "Count"
<< " Percent Cumulative"
<< " : Count Percent Cumulative\n";
int_least64_t max_distance = sorted.empty() ? 0 : sorted.back().first;
int64_t max_distance = sorted.empty() ? 0 : sorted.back().first;
double cum_percent = 0;
double data_cum_percent = 0;
int_least64_t bin_count = 0;
int_least64_t data_bin_count = 0;
int_least64_t bin_size = 1;
int64_t bin_count = 0;
int64_t data_bin_count = 0;
int64_t bin_size = 1;
double bin_size_float = 1.0;
int_least64_t bin_start = 0;
int_least64_t bin_next_start = bin_start + bin_size;
int64_t bin_start = 0;
int64_t bin_next_start = bin_start + bin_size;
for (auto it = sorted.begin(); it != sorted.end(); ++it) {
const auto this_bin_number = it->first;
auto data_it = dist_map_data.find(this_bin_number);
int_least64_t this_bin_count = it->second;
int_least64_t this_data_bin_count =
int64_t this_bin_count = it->second;
int64_t this_data_bin_count =
data_it == dist_map_data.end() ? 0 : data_it->second;
// The last bin needs to force an output.
bool last_bin = *it == sorted.back();
Expand Down Expand Up @@ -403,7 +403,7 @@ reuse_distance_t::print_histogram(std::ostream &out, int_least64_t total_count,
bin_start = bin_next_start;
bin_size_float *= bin_multiplier;
// Use floor() to favor smaller bin sizes.
bin_size = static_cast<int_least64_t>(std::floor(bin_size_float));
bin_size = static_cast<int64_t>(std::floor(bin_size_float));
bin_next_start = bin_start + bin_size;
}
bin_count += this_bin_count;
Expand Down
Loading