Make ompi_info behave a bit better if STL decides not to play with 0
length string constructors. Print a developer warning if we have a too-long field (in developer builds only). This commit was SVN r21315.
Этот коммит содержится в:
родитель
590fbcff6c
Коммит
07c7a7a255
@ -10,6 +10,7 @@
|
|||||||
# University of Stuttgart. All rights reserved.
|
# University of Stuttgart. All rights reserved.
|
||||||
# Copyright (c) 2004-2005 The Regents of the University of California.
|
# Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
# Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
|
||||||
# $COPYRIGHT$
|
# $COPYRIGHT$
|
||||||
#
|
#
|
||||||
# Additional copyrights may follow
|
# Additional copyrights may follow
|
||||||
@ -33,3 +34,12 @@ show this message to an Open MPI wizard:
|
|||||||
Source line number: %d
|
Source line number: %d
|
||||||
|
|
||||||
Aborting...
|
Aborting...
|
||||||
|
#
|
||||||
|
[developer warning: field too long]
|
||||||
|
**************************************************************************
|
||||||
|
*** DEVELOPER WARNING: A field in ompi_info output is too long and
|
||||||
|
*** will appear poorly in the prettyprint output.
|
||||||
|
***
|
||||||
|
*** Value: "%s"
|
||||||
|
*** Max length: %d
|
||||||
|
**************************************************************************
|
||||||
|
@ -41,6 +41,8 @@
|
|||||||
|
|
||||||
#include "ompi/tools/ompi_info/ompi_info.h"
|
#include "ompi/tools/ompi_info/ompi_info.h"
|
||||||
|
|
||||||
|
#include "opal/util/show_help.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace ompi_info;
|
using namespace ompi_info;
|
||||||
|
|
||||||
@ -187,12 +189,22 @@ void ompi_info::out(const string& pretty_message, const string &plain_message,
|
|||||||
int value)
|
int value)
|
||||||
{
|
{
|
||||||
if (ompi_info::pretty) {
|
if (ompi_info::pretty) {
|
||||||
string spaces(OMPI_max(centerpoint - pretty_message.length(), 0), ' ');
|
if (centerpoint > pretty_message.length()) {
|
||||||
if (!pretty_message.empty()) {
|
string spaces(centerpoint - pretty_message.length(), ' ');
|
||||||
cout << spaces << pretty_message << ": " << value << endl;
|
cout << spaces;
|
||||||
} else {
|
}
|
||||||
cout << spaces << " " << value << endl;
|
#if OPAL_ENABLE_DEBUG
|
||||||
}
|
else {
|
||||||
|
opal_show_help("help-ompi_info.txt",
|
||||||
|
"developer warning: field too long", false,
|
||||||
|
pretty_message.c_str(), centerpoint);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (!pretty_message.empty()) {
|
||||||
|
cout << pretty_message << ": " << value << endl;
|
||||||
|
} else {
|
||||||
|
cout << " " << value << endl;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!plain_message.empty()) {
|
if (!plain_message.empty()) {
|
||||||
cout << plain_message << ":" << value << endl;
|
cout << plain_message << ":" << value << endl;
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user