#include "instruction_simplifier_arm.h"
#include "intrinsics.h"
#include "jit/debugger_interface.h"
+#include "jit/jit.h"
#include "jit/jit_code_cache.h"
#include "jni/quick/jni_compiler.h"
#include "licm.h"
elf_file.size());
}
+ Runtime::Current()->GetJit()->AddMemoryUsage(method, arena.BytesUsed());
+
return true;
}
#include "base/bit_utils.h"
#include "base/time_utils.h"
+#include "utils.h"
namespace art {
}
template <class Value>
+inline void Histogram<Value>::PrintMemoryUse(std::ostream &os) const {
+ os << Name()
+ << ": Avg: " << PrettySize(Mean()) << " Max: "
+ << PrettySize(Max()) << " Min: " << PrettySize(Min()) << "\n";
+}
+
+template <class Value>
inline void Histogram<Value>::CreateHistogram(CumulativeData* out_data) const {
DCHECK_GT(sample_size_, 0ull);
out_data->freq_.clear();
double Percentile(double per, const CumulativeData& data) const;
void PrintConfidenceIntervals(std::ostream& os, double interval,
const CumulativeData& data) const;
+ void PrintMemoryUse(std::ostream& os) const;
void PrintBins(std::ostream& os, const CumulativeData& data) const;
void DumpBins(std::ostream& os) const;
Value GetRange(size_t bucket_idx) const;
void Jit::DumpInfo(std::ostream& os) {
code_cache_->Dump(os);
cumulative_timings_.Dump(os);
+ MutexLock mu(Thread::Current(), lock_);
+ memory_use_.PrintMemoryUse(os);
}
void Jit::AddTimingLogger(const TimingLogger& logger) {
jit_compile_method_(nullptr),
dump_info_on_shutdown_(false),
cumulative_timings_("JIT timings"),
+ memory_use_("Memory used for compilation", 16),
+ lock_("JIT memory use lock"),
save_profiling_info_(false),
generate_debug_info_(false) {
}
return true;
}
+void Jit::AddMemoryUsage(ArtMethod* method, size_t bytes) {
+ if (bytes > 4 * MB) {
+ LOG(INFO) << "Compiler allocated "
+ << PrettySize(bytes)
+ << " to compile "
+ << PrettyMethod(method);
+ }
+ MutexLock mu(Thread::Current(), lock_);
+ memory_use_.AddValue(bytes);
+}
+
} // namespace jit
} // namespace art
#ifndef ART_RUNTIME_JIT_JIT_H_
#define ART_RUNTIME_JIT_JIT_H_
-#include <unordered_map>
-
-#include "atomic.h"
+#include "base/arena_allocator.h"
+#include "base/histogram-inl.h"
#include "base/macros.h"
#include "base/mutex.h"
#include "base/timing_logger.h"
-#include "gc_root.h"
-#include "jni.h"
#include "object_callbacks.h"
#include "offline_profiling_info.h"
#include "thread_pool.h"
void DeleteThreadPool();
// Dump interesting info: #methods compiled, code vs data size, compile / verify cumulative
// loggers.
- void DumpInfo(std::ostream& os);
+ void DumpInfo(std::ostream& os) REQUIRES(!lock_);
// Add a timing logger to cumulative_timings_.
void AddTimingLogger(const TimingLogger& logger);
+
+ void AddMemoryUsage(ArtMethod* method, size_t bytes)
+ REQUIRES(!lock_)
+ SHARED_REQUIRES(Locks::mutator_lock_);
+
JitInstrumentationCache* GetInstrumentationCache() const {
return instrumentation_cache_.get();
}
const std::string& app_dir);
void StopProfileSaver();
- void DumpForSigQuit(std::ostream& os) {
+ void DumpForSigQuit(std::ostream& os) REQUIRES(!lock_) {
DumpInfo(os);
}
// Performance monitoring.
bool dump_info_on_shutdown_;
CumulativeLogger cumulative_timings_;
+ Histogram<uint64_t> memory_use_ GUARDED_BY(lock_);
+ Mutex lock_ DEFAULT_MUTEX_ACQUIRED_AFTER;
std::unique_ptr<jit::JitInstrumentationCache> instrumentation_cache_;
std::unique_ptr<jit::JitCodeCache> code_cache_;