fix printfs of 64bit numbers when compiling for 32 bit

this caused issues when compiling in 32bit on RPi2
master
Andre Puschmann 5 years ago
parent e495c4d553
commit 20d9a83dac

@ -21,6 +21,7 @@
#include "srslte/common/time_prof.h" #include "srslte/common/time_prof.h"
#include <algorithm> #include <algorithm>
#include <inttypes.h>
#include <numeric> #include <numeric>
using namespace srslte; using namespace srslte;
@ -72,8 +73,8 @@ void avg_time_stats::operator()(nanoseconds duration)
{ {
count++; count++;
avg_val = avg_val * (count - 1) / count + static_cast<double>(duration.count()) / count; avg_val = avg_val * (count - 1) / count + static_cast<double>(duration.count()) / count;
max_val = std::max(max_val, duration.count()); max_val = std::max<long>(max_val, duration.count());
min_val = std::min(min_val, duration.count()); min_val = std::min<long>(min_val, duration.count());
if (count % print_period == 0) { if (count % print_period == 0) {
log_ptr->info("%s: {mean, max, min}={%0.1f, %ld, %ld} usec, nof_samples=%ld", log_ptr->info("%s: {mean, max, min}={%0.1f, %ld, %ld} usec, nof_samples=%ld",
name.c_str(), name.c_str(),
@ -99,7 +100,7 @@ void sliding_window_stats<TUnit>::operator()(nanoseconds duration)
const char* unit_str = get_tunit_str<TUnit>(); const char* unit_str = get_tunit_str<TUnit>();
TUnit dur = std::chrono::duration_cast<TUnit>(duration); TUnit dur = std::chrono::duration_cast<TUnit>(duration);
log_ptr->debug("%s: duration=%ld %s\n", name.c_str(), dur.count(), unit_str); log_ptr->debug("%s: duration=%" PRId64 " %s\n", name.c_str(), dur.count(), unit_str);
sliding_window[window_idx++] = duration; sliding_window[window_idx++] = duration;
if (window_idx == sliding_window.size()) { if (window_idx == sliding_window.size()) {
@ -108,7 +109,7 @@ void sliding_window_stats<TUnit>::operator()(nanoseconds duration)
nanoseconds tmin = *std::min_element(sliding_window.begin(), sliding_window.end()); nanoseconds tmin = *std::min_element(sliding_window.begin(), sliding_window.end());
double tmean = static_cast<double>(duration_cast<TUnit>(tsum).count()) / sliding_window.size(); double tmean = static_cast<double>(duration_cast<TUnit>(tsum).count()) / sliding_window.size();
log_ptr->info("%s: {mean, max, min} = {%0.2f, %ld, %ld} %s\n", log_ptr->info("%s: {mean, max, min} = {%0.2f, %" PRId64 ", %" PRId64 "} %s\n",
name.c_str(), name.c_str(),
tmean, tmean,
duration_cast<TUnit>(tmax).count(), duration_cast<TUnit>(tmax).count(),

@ -108,7 +108,7 @@ void intra_measure::set_cells_to_meas(const std::set<uint32_t>& pci)
active_pci = pci; active_pci = pci;
active_pci_mutex.unlock(); active_pci_mutex.unlock();
state.set_state(internal_state::receive); state.set_state(internal_state::receive);
log_h->info("INTRA: Received list of %lu neighbour cells to measure in EARFCN %d.\n", pci.size(), current_earfcn); log_h->info("INTRA: Received list of %zd neighbour cells to measure in EARFCN %d.\n", pci.size(), current_earfcn);
} }
void intra_measure::write(uint32_t tti, cf_t* data, uint32_t nsamples) void intra_measure::write(uint32_t tti, cf_t* data, uint32_t nsamples)

@ -306,7 +306,7 @@ void ue_stack_lte::run_tti_impl(uint32_t tti, uint32_t tti_jump)
if (args.have_tti_time_stats) { if (args.have_tti_time_stats) {
std::chrono::nanoseconds dur = tti_tprof.stop(); std::chrono::nanoseconds dur = tti_tprof.stop();
if (dur > TTI_WARN_THRESHOLD_MS) { if (dur > TTI_WARN_THRESHOLD_MS) {
mac_log->warning("%s: detected long duration=%ld ms\n", mac_log->warning("%s: detected long duration=%" PRId64 "ms\n",
"proc_time", "proc_time",
std::chrono::duration_cast<std::chrono::milliseconds>(dur).count()); std::chrono::duration_cast<std::chrono::milliseconds>(dur).count());
} }

Loading…
Cancel
Save