equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
1840 } |
1840 } |
1841 } |
1841 } |
1842 } |
1842 } |
1843 |
1843 |
1844 // dump the heap to given path. |
1844 // dump the heap to given path. |
|
1845 PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL |
1845 int HeapDumper::dump(const char* path) { |
1846 int HeapDumper::dump(const char* path) { |
1846 assert(path != NULL && strlen(path) > 0, "path missing"); |
1847 assert(path != NULL && strlen(path) > 0, "path missing"); |
1847 |
1848 |
1848 // print message in interactive case |
1849 // print message in interactive case |
1849 if (print_to_tty()) { |
1850 if (print_to_tty()) { |
1880 timer()->stop(); |
1881 timer()->stop(); |
1881 if (error() == NULL) { |
1882 if (error() == NULL) { |
1882 char msg[256]; |
1883 char msg[256]; |
1883 sprintf(msg, "Heap dump file created [%s bytes in %3.3f secs]", |
1884 sprintf(msg, "Heap dump file created [%s bytes in %3.3f secs]", |
1884 JLONG_FORMAT, timer()->seconds()); |
1885 JLONG_FORMAT, timer()->seconds()); |
|
1886 PRAGMA_DIAG_PUSH |
|
1887 PRAGMA_FORMAT_NONLITERAL_IGNORED_INTERNAL |
1885 tty->print_cr(msg, writer.bytes_written()); |
1888 tty->print_cr(msg, writer.bytes_written()); |
|
1889 PRAGMA_DIAG_POP |
1886 } else { |
1890 } else { |
1887 tty->print_cr("Dump file is incomplete: %s", writer.error()); |
1891 tty->print_cr("Dump file is incomplete: %s", writer.error()); |
1888 } |
1892 } |
1889 } |
1893 } |
1890 |
1894 |