2197
2198 AdapterHandlerLibrary::print_statistics();
2199
2200 if (xtty != NULL) xtty->tail("statistics");
2201 }
2202
2203 inline double percent(int x, int y) {
2204 return 100.0 * x / MAX2(y, 1);
2205 }
2206
2207 class MethodArityHistogram {
2208 public:
2209 enum { MAX_ARITY = 256 };
2210 private:
2211 static int _arity_histogram[MAX_ARITY]; // histogram of #args
2212 static int _size_histogram[MAX_ARITY]; // histogram of arg size in words
2213 static int _max_arity; // max. arity seen
2214 static int _max_size; // max. arg size seen
2215
2216 static void add_method_to_histogram(nmethod* nm) {
2217 if (CompiledMethod::nmethod_access_is_safe(nm)) {
2218 Method* method = nm->method();
2219 ArgumentCount args(method->signature());
2220 int arity = args.size() + (method->is_static() ? 0 : 1);
2221 int argsize = method->size_of_parameters();
2222 arity = MIN2(arity, MAX_ARITY-1);
2223 argsize = MIN2(argsize, MAX_ARITY-1);
2224 int count = method->compiled_invocation_count();
2225 _arity_histogram[arity] += count;
2226 _size_histogram[argsize] += count;
2227 _max_arity = MAX2(_max_arity, arity);
2228 _max_size = MAX2(_max_size, argsize);
2229 }
2230 }
2231
2232 void print_histogram_helper(int n, int* histo, const char* name) {
2233 const int N = MIN2(5, n);
2234 tty->print_cr("\nHistogram of call arity (incl. rcvr, calls to compiled methods only):");
2235 double sum = 0;
2236 double weighted_sum = 0;
2237 int i;
|
2197
2198 AdapterHandlerLibrary::print_statistics();
2199
2200 if (xtty != NULL) xtty->tail("statistics");
2201 }
2202
2203 inline double percent(int x, int y) {
2204 return 100.0 * x / MAX2(y, 1);
2205 }
2206
2207 class MethodArityHistogram {
2208 public:
2209 enum { MAX_ARITY = 256 };
2210 private:
2211 static int _arity_histogram[MAX_ARITY]; // histogram of #args
2212 static int _size_histogram[MAX_ARITY]; // histogram of arg size in words
2213 static int _max_arity; // max. arity seen
2214 static int _max_size; // max. arg size seen
2215
2216 static void add_method_to_histogram(nmethod* nm) {
2217 if (nmethod::access_is_safe(nm)) {
2218 Method* method = nm->method();
2219 ArgumentCount args(method->signature());
2220 int arity = args.size() + (method->is_static() ? 0 : 1);
2221 int argsize = method->size_of_parameters();
2222 arity = MIN2(arity, MAX_ARITY-1);
2223 argsize = MIN2(argsize, MAX_ARITY-1);
2224 int count = method->compiled_invocation_count();
2225 _arity_histogram[arity] += count;
2226 _size_histogram[argsize] += count;
2227 _max_arity = MAX2(_max_arity, arity);
2228 _max_size = MAX2(_max_size, argsize);
2229 }
2230 }
2231
2232 void print_histogram_helper(int n, int* histo, const char* name) {
2233 const int N = MIN2(5, n);
2234 tty->print_cr("\nHistogram of call arity (incl. rcvr, calls to compiled methods only):");
2235 double sum = 0;
2236 double weighted_sum = 0;
2237 int i;
|