1 /*
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
313
314 // we categorize memory into three categories within the memory type
315 MallocMem _malloc_data[NUMBER_OF_MEMORY_TYPE];
316 VMMem _vm_data[NUMBER_OF_MEMORY_TYPE];
317 ArenaMem _arena_data[NUMBER_OF_MEMORY_TYPE];
318
319 // memory records that aggregate memory usage by callsites.
320 // only available when detail tracking is on.
321 MemPointerArray* _malloc_cs;
322 MemPointerArray* _vm_cs;
323 // virtual memory map
324 MemPointerArray* _vm_map;
325
326 private:
327 static MemType2Name MemType2NameMap[NUMBER_OF_MEMORY_TYPE];
328
329 private:
330 // should not use copy constructor
331 MemBaseline(MemBaseline& copy) { ShouldNotReachHere(); }
332
333 public:
334 // create a memory baseline
335 MemBaseline();
336
337 virtual ~MemBaseline();
338
339 inline bool baselined() const {
340 return _baselined;
341 }
342
343 MemBaseline& operator=(const MemBaseline& other);
344
345 // reset the baseline for reuse
346 void clear();
347
348 // baseline the snapshot
349 bool baseline(MemSnapshot& snapshot, bool summary_only = true);
350
351 bool baseline(const MemPointerArray* malloc_records,
352 const MemPointerArray* vm_records,
|
1 /*
2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
313
314 // we categorize memory into three categories within the memory type
315 MallocMem _malloc_data[NUMBER_OF_MEMORY_TYPE];
316 VMMem _vm_data[NUMBER_OF_MEMORY_TYPE];
317 ArenaMem _arena_data[NUMBER_OF_MEMORY_TYPE];
318
319 // memory records that aggregate memory usage by callsites.
320 // only available when detail tracking is on.
321 MemPointerArray* _malloc_cs;
322 MemPointerArray* _vm_cs;
323 // virtual memory map
324 MemPointerArray* _vm_map;
325
326 private:
327 static MemType2Name MemType2NameMap[NUMBER_OF_MEMORY_TYPE];
328
329 private:
330 // should not use copy constructor
331 MemBaseline(MemBaseline& copy) { ShouldNotReachHere(); }
332
333 // check and block at a safepoint
334 static inline void check_safepoint(JavaThread* thr);
335
336 public:
337 // create a memory baseline
338 MemBaseline();
339
340 virtual ~MemBaseline();
341
342 inline bool baselined() const {
343 return _baselined;
344 }
345
346 MemBaseline& operator=(const MemBaseline& other);
347
348 // reset the baseline for reuse
349 void clear();
350
351 // baseline the snapshot
352 bool baseline(MemSnapshot& snapshot, bool summary_only = true);
353
354 bool baseline(const MemPointerArray* malloc_records,
355 const MemPointerArray* vm_records,
|