MantisBT - Open CASCADE
View Issue Details
0029451Open CASCADE[OCCT] OCCT:Foundation Classespublic2018-01-25 18:332020-10-03 14:40
nds 
bugmaster 
normalfeature 
verifiedfixed 
[OCCT] 7.3.0 
[OCCT] 7.5.0 
demo/draw/messenger
0029451: Information Message Alert to debug an algorithm or object functionality
While developing applications on the base of OCCT, it would be nice to have some hierarchical report about functions called and current state of used objects on different steps of the execution.
Having implemented Message_Report - Message_Alert mechanism, we may provide such information using it.

We just need to:
- add such alert into message report when algorithm performs its job.
- have some tool to see tree of alerts (or output stream).

Also, it might be useful to collect some metrics(time or memory) about some piece of code execution.
No tags attached.
related to 0031362new nds Open CASCADE Inspectors - MessageView plugin for message alerts 
related to 0023237closed omy Open CASCADE OSD_PerfMeter reports wrong (zero) times 
parent of 0031804verified bugmaster Open CASCADE Foundation Classes - Store Message_Report in Json format 
parent of 0031818new nds Open CASCADE Documentation - Describe using Message_Report generating via Message_Messenger 
related to 0030056new oan Open CASCADE Rename fail statuses entered in BRepMesh algorith in the issue 0026106 
Not all the children of this issue are yet resolved or closed.
png osstrem_on_as1.png (38,014) 2020-01-24 08:54
https://tracker.dev.opencascade.org/
png MessageView_on_as1.png (56,959) 2020-01-24 08:55
https://tracker.dev.opencascade.org/
png messenger_test_result.png (43,679) 2020-09-30 16:00
https://tracker.dev.opencascade.org/
Issue History
2018-01-25 18:33ndsNew Issue
2018-01-25 18:33ndsAssigned To => nds
2018-01-25 18:48gitNote Added: 0073597
2018-01-26 07:18gitNote Added: 0073598
2018-01-26 10:55gitNote Added: 0073607
2018-01-29 12:59abvNote Added: 0073649
2018-01-29 15:13gitNote Added: 0073655
2018-01-29 15:23gitNote Added: 0073657
2018-01-29 18:37gitNote Added: 0073667
2018-06-28 11:01gitNote Added: 0077085
2019-02-22 17:01ndsRelationship addedrelated to 0030056
2019-02-25 11:24gitNote Added: 0082324
2019-09-06 07:15gitNote Added: 0086827
2019-09-06 09:21ndsNote Added: 0086837
2019-09-06 09:21ndsAssigned Tonds => kgv
2019-09-25 22:05abvTarget Version7.4.0 => 7.5.0
2019-09-26 09:36ndsAssigned Tokgv => nds
2019-10-10 20:10gitNote Added: 0088028
2020-01-23 20:15gitNote Added: 0090031
2020-01-24 08:15gitNote Added: 0090032
2020-01-24 08:16gitNote Added: 0090033
2020-01-24 08:44ndsNote Added: 0090034
2020-01-24 08:44ndsAssigned Tonds => abv
2020-01-24 08:44ndsStatusnew => resolved
2020-01-24 08:44ndsDescription Updatedbug_revision_view_page.php?rev_id=22471#r22471
2020-01-24 08:54ndsNote Added: 0090035
2020-01-24 08:54ndsFile Added: osstrem_on_as1.png
2020-01-24 08:55ndsFile Added: MessageView_on_as1.png
2020-01-29 11:28ndsNote Added: 0090128
2020-01-29 11:30ndsNote Added: 0090129
2020-01-29 11:30ndsAssigned Toabv => kgv
2020-01-29 18:58kgvNote Added: 0090169
2020-01-30 12:07kgvAssigned Tokgv => nds
2020-01-30 12:07kgvStatusresolved => assigned
2020-01-31 15:22gitNote Added: 0090231
2020-02-09 10:24ndsRelationship addedrelated to 0031362
2020-02-12 23:44gitNote Added: 0090501
2020-03-02 11:49kgvRelationship addedrelated to 0030841
2020-04-11 10:43gitNote Added: 0091510
2020-04-28 08:11ndsRelationship addedrelated to 0028786
2020-09-09 11:10gitNote Added: 0094289
2020-09-09 11:12gitNote Added: 0094290
2020-09-24 17:42gitNote Added: 0095279
2020-09-24 17:51gitNote Added: 0095280
2020-09-24 17:53ndsNote Added: 0095281
2020-09-24 17:53ndsAssigned Tonds => abv
2020-09-24 17:53ndsStatusassigned => resolved
2020-09-24 18:33gitNote Added: 0095284
2020-09-25 00:56gitNote Added: 0095295
2020-09-25 19:18abvNote Added: 0095339
2020-09-25 19:18abvAssigned Toabv => bugmaster
2020-09-25 19:18abvStatusresolved => reviewed
2020-09-25 19:50gitNote Added: 0095340
2020-09-25 19:51kgvNote Added: 0095341
2020-09-25 19:53gitNote Added: 0095342
2020-09-25 20:17kgvNote Added: 0095344
2020-09-25 20:19gitNote Added: 0095345
2020-09-25 20:21kgvNote Added: 0095346
2020-09-25 20:22kgvAssigned Tobugmaster => nds
2020-09-25 20:22kgvStatusreviewed => assigned
2020-09-25 20:22gitNote Added: 0095347
2020-09-25 20:34gitNote Added: 0095348
2020-09-25 21:20gitNote Added: 0095350
2020-09-26 06:03abvNote Added: 0095351
2020-09-29 05:49gitNote Added: 0095454
2020-09-29 06:22gitNote Added: 0095455
2020-09-29 12:28gitNote Added: 0095461
2020-09-29 16:43gitNote Added: 0095470
2020-09-29 19:33ndsRelationship addedparent of 0031804
2020-09-29 19:41ndsNote Added: 0095474
2020-09-29 19:41ndsAssigned Tonds => abv
2020-09-29 19:41ndsStatusassigned => resolved
2020-09-29 19:43ndsNote Edited: 0095474bug_revision_view_page.php?bugnote_id=95474#r23637
2020-09-30 11:37ndsNote Added: 0095484
2020-09-30 11:37ndsAssigned Toabv => nds
2020-09-30 11:37ndsStatusresolved => assigned
2020-09-30 15:42gitNote Added: 0095495
2020-09-30 15:46gitNote Added: 0095496
2020-09-30 15:59ndsNote Added: 0095500
2020-09-30 15:59ndsAssigned Tonds => abv
2020-09-30 15:59ndsStatusassigned => resolved
2020-09-30 16:00ndsFile Added: messenger_test_result.png
2020-09-30 17:55gitNote Added: 0095502
2020-09-30 22:19kgvNote Added: 0095509
2020-09-30 22:27kgvNote Added: 0095510
2020-09-30 22:28kgvNote Edited: 0095510bug_revision_view_page.php?bugnote_id=95510#r23666
2020-09-30 22:34kgvNote Added: 0095511
2020-09-30 22:34kgvNote Edited: 0095511bug_revision_view_page.php?bugnote_id=95511#r23668
2020-09-30 22:36kgvRelationship addedrelated to 0023237
2020-10-01 06:49abvNote Added: 0095513
2020-10-01 06:49abvAssigned Toabv => nds
2020-10-01 06:49abvStatusresolved => assigned
2020-10-02 14:12gitNote Added: 0095578
2020-10-02 14:14gitNote Added: 0095579
2020-10-02 15:16gitNote Added: 0095581
2020-10-02 18:06gitNote Added: 0095596
2020-10-02 18:18ndsRelationship addedparent of 0031818
2020-10-02 18:20ndsNote Added: 0095599
2020-10-02 18:20ndsAssigned Tonds => abv
2020-10-02 18:20ndsStatusassigned => resolved
2020-10-02 18:37ndsNote Edited: 0095599bug_revision_view_page.php?bugnote_id=95599#r23685
2020-10-02 18:39gitNote Added: 0095601
2020-10-02 21:41abvNote Added: 0095604
2020-10-02 21:41abvAssigned Toabv => bugmaster
2020-10-02 21:41abvStatusresolved => reviewed
2020-10-03 12:57bugmasterTest case number => demo/draw/messenger
2020-10-03 14:04bugmasterNote Added: 0095635
2020-10-03 14:04bugmasterStatusreviewed => tested
2020-10-03 14:05bugmasterChangeset attached => occt master 6522304c
2020-10-03 14:05bugmasterStatustested => verified
2020-10-03 14:05bugmasterResolutionopen => fixed
2020-10-03 14:38gitNote Added: 0095643
2020-10-03 14:38gitNote Added: 0095645
2020-10-03 14:38gitNote Added: 0095646
2020-10-03 14:38gitNote Added: 0095651
2020-10-03 14:38gitNote Added: 0095655
2020-10-03 14:39gitNote Added: 0095664
2020-10-03 14:39gitNote Added: 0095667
2020-10-03 14:39gitNote Added: 0095670
2020-10-03 14:39gitNote Added: 0095671
2020-10-03 14:39gitNote Added: 0095672
2020-10-03 14:39gitNote Added: 0095673
2020-10-03 14:39gitNote Added: 0095674
2020-10-03 14:39gitNote Added: 0095675
2020-10-03 14:39gitNote Added: 0095676
2020-10-03 14:39gitNote Added: 0095677
2020-10-03 14:39gitNote Added: 0095680
2020-10-03 14:39gitNote Added: 0095681
2020-10-03 14:40gitNote Added: 0095682
2020-10-03 14:40gitNote Added: 0095683

Notes
(0073597)
git   
2018-01-25 18:48   
Branch CR29451 has been created by nds.

SHA-1: 1d7ab7892086b81bba000b10b68c7abafa466aae


Detailed log of new commits:

Author: nds
Date: Thu Jan 25 18:48:10 2018 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality
    
    Modifications:
    - Message alerts hierarchical structure (to debug an algorithm stages and parameters)
    - Using message alerts in AIS_Interactive context to see history of calls.
    - Message_ReportCall back to be able to react to message report filling.
    - Information alerts in boolean algorithms.
    - Import/Export report. Currently it is implemented using XmlDrivers_MessageReportStorage
    - Improvements in Inspector functionality (main are: new plugin MessageView; preferences for plugins to save/restore widgets geometry, tree view columns state)
(0073598)
git   
2018-01-26 07:18   
Branch CR29451 has been updated by nds.

SHA-1: ad8452421f30c3a38f684aff030b02b055a8edf2


Detailed log of new commits:

Author: nds
Date: Fri Jan 26 07:18:54 2018 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality
    
    #Linux/qt4 compile error correction

(0073607)
git   
2018-01-26 10:55   
Branch CR29451 has been updated by nds.

SHA-1: c5ec85b98925b56c42cba096c0747e821ef5eeea


Detailed log of new commits:

Author: nds
Date: Fri Jan 26 10:55:47 2018 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality
    
    # Qt4 compile error correction

(0073649)
abv   
2018-01-29 12:59   
Some remarks:

- As already indicated by Kirill, unconditional generation of alerts added in many functions in AIS and BOPAlgo will likely harm performance, but does not bring any benefits for majority of use cases; please avoid this (at least, not in production code). Generation and collection of this kind of info can be useful only in specific contexts (debug?) and should be triggered explicitly.

- Class Message_AlertWithObject could be made templated with argument being the type to be stored. (And please fill "Created on:" and "Created by:" in the header comments).

- Changes in the class Message_Alert (addition of name and array of lists of sub-alerts) make it quite heavy, while initial intent was to have it as small and fast as possible to allow algorithms generating as many alerts as needed without extra penalties. In addition, this makes alert to have the same structure as whole report. Please reconsider this. A compromise could be to add dedicated class like CompositeAlert. But should not reports be made nested instead of alerts (if really needed)? Besides, by looking at how composite alerts are generated, I have a feeling that they can all be replaced by single alert with multi-line text.

- On changes in the Report class:

-- The approach to computing elapsed time and its meaning is not clear, please explain (or document). In my opinion, it can make sense to record just a wall clock time for the alert generation instance. Elapsed time, when needed, is related to some process and not alerts, hence it should be rather measured on the algorithm side. It can be reported using specific alert.

-- Storage of myAlertOfTimer as field apparently makes this functionality not applicable to multi-threaded applications

-- Method Message_Report::SetActive() calls itself recursively without real need

-- Method GetLastAlert() does not seem to be needed; in most places where GetLastInfo() (that uses that method) is used, it is assumed to return the alert created just a few lines above. There is no sense to use such complicated ways to get last alert if it is actually available in the same code. In addition, this will not work in multithreaded setting.

- Message_ReportCallback it is called only on event of adding new alert; should not it get this alert as parameter?
(0073655)
git   
2018-01-29 15:13   
Branch CR29451_1 has been created by nds.

SHA-1: b52d3b7d969a3220d91f05effc11d5c7058edbaa


Detailed log of new commits:

Author: nds
Date: Thu Jan 25 18:48:10 2018 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality
    
    Modifications:
    - Message alerts hierarchical structure (to debug an algorithm stages and parameters)
    - Using message alerts in AIS_Interactive context to see history of calls.
    - Message_ReportCall back to be able to react to message report filling.
    - Information alerts in boolean algorithms.
    - Import/Export report. Currently it is implemented using XmlDrivers_MessageReportStorage
    - Improvements in Inspector functionality (main are: new plugin MessageView; preferences for plugins to save/restore widgets geometry, tree view columns state)
(0073657)
git   
2018-01-29 15:23   
Branch CR29451_1 has been updated by nds.

SHA-1: 38288285145948b08f127a6e7b0cda74cb888087


Detailed log of new commits:

Author: nds
Date: Mon Jan 29 15:23:10 2018 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality
    
    Modifications:
    - ViewControl_PropertyView to fill property dockable widget in any plugin (further)
    - ViewControl package for common GUI controls

(0073667)
git   
2018-01-29 18:37   
Branch CR29451_1 has been updated by nds.

SHA-1: 81cd71203e47f87527516014f2690f20ef5c25c8


Detailed log of new commits:

Author: nds
Date: Mon Jan 29 18:37:00 2018 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality
    
    Modifications:
    - do not create new Message_Info gravity alerts if this gravity is not active in the report. Add_report_info is implemented for it.
    - code style remarks

(0077085)
git   
2018-06-28 11:01   
Branch CR29451_2 has been created by nds.

SHA-1: e4529dcf83b12759e47efb89ded8207f802556a7


Detailed log of new commits:

Author: nds
Date: Thu Jun 28 11:00:39 2018 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality
    
    Modifications:
     - Message_AlertExtended to store additional parameters (attributes, composite alert container, performance meter)
     - Message_Attribute and inherited classes to store custom information about alert
     - Message_CompositeAlerts to have hierarchical structure of alerts
     - Message_PerfMeter to automatically calculate time between alerts adding into report
     - Message_ReportCall back to be able to react to message report filling.
     - Import/Export message report report. Currently it is implemented using XmlDrivers_MessageReportStorage
     - MessageView/MessageModel - Inspector plugin for GUI presentation of Message_Report
(0082324)
git   
2019-02-25 11:24   
Branch CR29451_3 has been created by nds.

SHA-1: 9dae9d43ba992a094fb387648bcd5503b487f698


Detailed log of new commits:

Author: nds
Date: Mon Feb 25 11:19:56 2019 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality
    
    Modifications:
     - Message_AlertExtended to store additional parameters (attributes, composite alert container, performance meter)
     - Message_Attribute and inherited classes to store custom information about alert
     - Message_CompositeAlerts to have hierarchical structure of alerts
     - Message_PerfMeter to automatically calculate time between alerts adding into report
     - Message_ReportCall back to be able to react to message report filling.
     - Import/Export message report report. Currently it is implemented using XmlDrivers_MessageReportStorage
     - MessageView/MessageModel - Inspector plugin for GUI presentation of Message_Report
    
    Sample of using alerts:
    - BRepMesh_IncremetalMesh - till IMeshTools_ShapeExplorer::Accept() for model maps filling (debug of 0030497 issue)
    
    DRAW case:
     - tools/messageview/A1
(0086827)
git   
2019-09-06 07:15   
Branch CR29451_4 has been created by nds.

SHA-1: 572ee342a1aa2f30d3a77e56e49a5ab4e39dcd2d


Detailed log of new commits:

Author: nds
Date: Fri Sep 6 07:11:57 2019 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality,
(0086837)
nds   
2019-09-06 09:21   
Dear Kirill,

please give your recommendations about CR29451_4.

Thank you in advance, Natalia
(0088028)
git   
2019-10-10 20:10   
Branch CR29451_5 has been created by nds.

SHA-1: 1f64bcf7813ab6bad61310ae6f19539d133f1ac4


Detailed log of new commits:

Author: nds
Date: Fri Oct 4 18:30:10 2019 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality
(0090031)
git   
2020-01-23 20:15   
Branch CR29451_6 has been created by nds.

SHA-1: 710257e8575e192b75a928f5619be9eb958cfe45


Detailed log of new commits:

Author: nds
Date: Thu Jan 23 20:11:53 2020 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality
    
    # Leveled report using sentry approach
    # attributes (steam, object, TopoDS_Shape) for extended alerts
    # STEP reading trace level setting to fill leveled Message_Report
(0090032)
git   
2020-01-24 08:15   
Branch CR29451_6 has been updated by nds.

SHA-1: 277b2d69fbbd1ccb641982205006e077e7ac8953


Detailed log of new commits:

Author: nds
Date: Fri Jan 24 08:11:36 2020 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality
    
    # warnings correction

(0090033)
git   
2020-01-24 08:16   
Branch CR29451_7 has been created by nds.

SHA-1: 2b52341e35876f55fb2a469d2da2da629abc0245


Detailed log of new commits:

Author: nds
Date: Thu Jan 23 20:11:53 2020 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality
    
    # Leveled report using sentry approach
    # attributes (steam, object, TopoDS_Shape) for extended alerts
    # STEP reading trace level setting to fill leveled Message_Report
(0090034)
nds   
2020-01-24 08:44   
Dear Andrey

could you please have a look at modifications proposed on branch CR29451_7.

Jenkins job is: http://vm-jenkins-test-12.nnov.opencascade.com:8080/view/CR29451_6-master-NDS/. [^]

Thank you in advance, Natalia
(0090035)
nds   
2020-01-24 08:54   
attached test case, will generate a report about step loading into output console,
'osstrem_on_as1.png';
after 0030268 finalization, this report might be displayed in inspector:
'MessageView_on_as1.png'
(0090128)
nds   
2020-01-29 11:28   
Questions to discuss:
1. Message_Level is an s-entry that in charge of a level creation/destroy in a report. We need to have it in memory during algorithm (see STEPControl_ActorRead). Is is appropriate? It creates this variable even if trace level is zero.
2. TopoDS_AlertAttribute vs TopoDS_AlertWithShape. May the second one be replaced by the first one?
3. Step reader: where the trace level is better to be set? It seems not very convenient using XSControl_TransferReader (see XDEDRAW_Common).
4. Write Message_Report: what is the better place? DDocStd_ToolsCommands is proposed.
5. Message_Report export to XML is implemented (XmlDrivers_MessageReportStorage). The further proposal is to export in binary file to be able to store TopoDS_Shape as binary information. Now, the shape is not exported.
6. Message_Report uses Message_CompositeAlerts instead of myAlert. Is it appropriate?
7. Message_CompositeAlerts is this name is correct? This class is responsible for hierarchy of alerts.
(0090129)
nds   
2020-01-29 11:30   
Dear Kirill

if possible, could you please review provided modifications.

Thank you in advance, Natalia
(0090169)
kgv   
2020-01-29 18:58   
+    di << "DDocStd_WriteReport : Error not enough argument\n";
+    return 1;

Unexpected output to Tcl stream, while throwing Tcl exception

+  theCommands.Add ("WriteReport", 
+                   "WriteReport path",

Command description is missing.

+  TCollection_ExtendedString path (a[1]); 

aPath.

+    std::cout << "Enable or disable report printer: " << a[0] << " 
{on|off}" << std::endl;

Please use Draw_Interpretor::PrintHelp() or just print "Syntax error: wrong number of arguments".

+  if (! strcmp (a[1], "on") && n == 2)

Case-insensitive comparison is preferred in Draw Harness.

+      std::cout << "Report printer has been already activated." << std::endl;

+      return 1;

While returning 1, please put "Error: " in message.

+  else {

Newline.

+    Standard_Integer aMetricId = atoi (a [i]);

Draw::Atoi().

+  theCommands.Add("dprintreport", "dprintreport [messenger] \n Sending report content 
to default messenger or stream (if parameter is absent).\n",

Send.

-  static Handle(Message_Messenger) aMessenger = new Message_Messenger;
-  return aMessenger;
+static Handle(Message_Messenger) MyMessenger;

Please revert.
You can wrap it to another method if needed like Message::ChangeDefaultMessenger() returning non-const reference.

+    case Message_MetricType_MemHeapUsage:      theMemInfo = OSD_MemInfo::MemHeapUsage; break;
+    default: return Standard_False;

It is better skipping "default" to get compiler warnings on missed enumeration items.

+  //! Sets default messenger for OCCT applications.
+  Standard_EXPORT static void SetDefaultMessenger (const Handle(Message_Messenger)& theMessenger);


"for OCCT applications" looks redundant and confusing.

+  //! @param theString string identifier
+  //! @param theType detected type of metric
+  //! @return TRUE if string identifier is known
+  Standard_EXPORT static Standard_Boolean MetricFromString (const Standard_CString theString,
+                                                            Message_MetricType& theType);

In such cases it is better specifying [in] and [out] tags within Doxygen comments.

+Handle (Message_CompositeAlerts) Message_AlertExtended::CompositeAlerts (const Standard_Boolean isCreate)


theToCreate
Handle(Message_CompositeAlerts)

+  for (int iGravity = Message_Trace; iGravity <= Message_Fail; ++iGravity)

aGravIter

+  virtual Standard_EXPORT Standard_CString GetMessageKey () const Standard_OVERRIDE;

Unexpected Standard_EXPORT location.

+  // OCCT RTTI

Redundant comment.

+  Standard_EXPORT Message_Attribute (const TCollection_AsciiString& theName = TCollection_AsciiString())

+    : myName (theName) {}
...
+  Standard_EXPORT Message_CompositeAlerts() {}
...
+  Standard_EXPORT void SetReport (const Handle(Message_Report)& theReport) { myReport = theReport; 
}
...
+  Standard_EXPORT void Clear() { myValue.Clear(); }

Redundant Standard_EXPORT for inline methods.

+Standard_Boolean Message_AttributeMeter::HasMetric (const Message_MetricType& theMetric) const

Redundant reference for enumeration argument.

+  return fabs (StartValue (theMetric) - UndefinedMetricValue()) > Precision::Confusion() &&


Abs().

+  return myMetrics.Find (theMetric).first;

Seek().

+  //! Returns default value of the metric when it is not defined
+  //! @return undefined value
+  static Standard_Real UndefinedMetricValue() { return -1.0; }

Please separate static methods from non-static with extra "public".
Static methods are usually put in front of class definition.

+  Handle(Standard_Transient) Object() const { return myObject; }

const Handle(Standard_Transient)&

+//=======================================================================
+//function : Merge
+//purpose  : 
+//=======================================================================
+Standard_Boolean Message_CompositeAlerts::RemoveAlert (Message_Gravity theGravity, const Handle(Message_Alert)& 
theAlert)

Mismatched comment.
Please also split into multiple lines.

+  if (!anAlerts.Contains (theAlert))
+      return Standard_False;
+
+  anAlerts.Remove (theAlert);
+  return Standard_True;

return anAlerts.Remove (theAlert);

+  Message_ListOfAlert myAlerts[Message_Fail + 1]; //!< container of child alert for each type of 
gravity
...
+  for (int iGravity = Message_Trace; iGravity <= Message_Fail; ++iGravity)

Please consider adding auxiliary constants for Message_Trace/Message_Fail enumeration range, as it might be extended in future.

+//=======================================================================
+//function : Destructor
+//purpose  :
+//=======================================================================
+Message_Level::Message_Level()

Mismatched comment.

+  OSD_MemInfo aMemInfo (Standard_False);
+  //aMemInfo.SetActiveCounters (aCounters);

To be updated.

+  Handle(Message_AlertExtended) RootAlert() const { return myRootAlert; }

const Handle(Message_AlertExtended)&

+  void setAlertMetrics (const Handle(Message_AlertExtended)& theAlert,
+                        const Standard_Boolean theStartValue);

Missing Standard_EXPORT.

+  Message_Gravity myOutputGravity; //!< gavity used in operator <<

gavity

+enum Message_MetricType
+{

Shouldn't it be bitmask?

+  Standard_EXPORT virtual void Send (const Standard_SStream& theStream, const Message_Gravity theGravity, 
const Standard_Boolean theToPutEol) const;
...
+  Standard_EXPORT virtual void Send (const Handle(Standard_Transient)& theObject, const Message_Gravity 
theGravity, const Standard_Boolean theToPutEol) const;

I believe that overloading Send() is not useful here - better making methods with new names.

+++ b/src/Message/Message_PrinterToReport.cxx
@@ -0,0 +1,119 @@
+// Created on: 2001-01-06
+// Created by: OCC Team
+// Copyright (c) 2001-2014 OPEN CASCADE SAS

Looks suspicious.

+  TCollection_AsciiString Value() const { return myValue; }

const TCollection_AsciiString&

+// HAsciiString
+inline const Handle(Message_Messenger)& operator<< (const Handle(Message_Messenger)& theMessenger,


What HAsciiString means here?

-         "Doc filename [mode]"
+         "Doc filename [mode] [-traceLevel level]"

Please document traceLevel range.

+const Handle(TDocStd_Application)& GetApplication()

Unexpected global function.

+       puts "There is not ${aFile} file; WriteReport command: Error"
+       return

Broken indentation or tabulation symbols.
(0090231)
git   
2020-01-31 15:22   
Branch CR29451_8 has been created by sshutina.

SHA-1: 907a45af595bc64be130ee9158217789788cfa50


Detailed log of new commits:

Author: sshutina
Date: Fri Jan 31 15:17:12 2020 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality
(0090501)
git   
2020-02-12 23:44   
Branch CR29451_9 has been created by nds.

SHA-1: f36aa84ef8e8efa1ed6d12efabce1d4e6de940d1


Detailed log of new commits:

Author: nds
Date: Wed Feb 12 23:41:59 2020 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality
(0091510)
git   
2020-04-11 10:43   
Branch CR29451_10 has been created by nds.

SHA-1: d84b3c4d0db98a43cc075bef601183bb0a272ff9


Detailed log of new commits:

Author: nds
Date: Wed Feb 12 23:41:59 2020 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality
(0094289)
git   
2020-09-09 11:10   
Branch CR29451_12 has been created by nds.

SHA-1: c00c6c10a61c298517ee58846f1cd6054ea8a6ba


No new revisions were added by this update.
(0094290)
git   
2020-09-09 11:12   
Branch CR29451_12 has been updated by nds.

SHA-1: 677e942292786e16258d61861b7ab7b4428897db


Detailed log of new commits:

Author: nds
Date: Wed Sep 9 11:15:51 2020 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality

(0095279)
git   
2020-09-24 17:42   
Branch CR29451_13_31362 has been created by nds.

SHA-1: ab82998b4791fe1c107fee5633366a95b9030ee8


Detailed log of new commits:

Author: nds
Date: Wed Sep 9 11:15:51 2020 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality
(0095280)
git   
2020-09-24 17:51   
Branch CR29451_13 has been created by nds.

SHA-1: 003057755c5c5548b3066f8bb6d2358896d3c18c


Detailed log of new commits:

Author: nds
Date: Thu Sep 24 17:54:55 2020 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality
(0095281)
nds   
2020-09-24 17:53   
Dear Andrey,

please review this patch on CR29451_13.

Thank you in advance, Natalia
(0095284)
git   
2020-09-24 18:33   
Branch CR29451_13 has been updated forcibly by nds.

SHA-1: 777697fac9be110d83a9742b832a66c7e6ceb118
(0095295)
git   
2020-09-25 00:56   
Branch CR29451_13 has been updated forcibly by nds.

SHA-1: 0aa519d11b6e4bca7f4340ec8389b8195222541f
(0095339)
abv   
2020-09-25 19:18   
Reviewed, please integrate. Jenkins tests are OK, see job CR29451-master-nds

OCCT branch: CR29451_13
Products: nothing
(0095340)
git   
2020-09-25 19:50   
Branch CR29451_13 has been updated by kgv.

SHA-1: 9af75d66b5c8924ce14cfbf5855f8f9fec8aa784


Detailed log of new commits:

Author: kgv
Date: Fri Sep 25 19:53:28 2020 +0300

    # remarks

(0095341)
kgv   
2020-09-25 19:51   
   Standard_EXPORT virtual void Send (const TCollection_AsciiString& theString,
                                      const Message_Gravity theGravity) const;
 
+  //! Send a string message with specified trace level.
+  //! Stream is converted to string value.
+  //! Default implementation calls first method Send().
+  Standard_EXPORT virtual void Send (const Standard_SStream& theStream, const Message_Gravity theGravity) 
const;
+
+  //! Send a string message with specified trace level.
+  //! The object is converted to string in format: <object kind> : <object pointer>.
+  //! Default implementation calls first method Send().
+  Standard_EXPORT virtual void Send (const Handle(Standard_Transient)& theObject, const Message_Gravity 
theGravity) const;

I disagree to add new co-named virtual Send() methods - please rename them.
(0095342)
git   
2020-09-25 19:53   
Branch CR29451_14 has been created by kgv.

SHA-1: 56940085936f4d813cce2cca6a51c37bc0cf95cc


Detailed log of new commits:

Author: nds
Date: Thu Sep 24 17:54:55 2020 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality
(0095344)
kgv   
2020-09-25 20:17   
void Draw::MessageCommands(Draw_Interpretor& theCommands)
{
  static Standard_Boolean Done = Standard_False;
  if (Done) return;
  Done = Standard_True;

  std::ios::sync_with_stdio();

Why this is necessary, and why it is globally enabled??
(0095345)
git   
2020-09-25 20:19   
Branch CR29451_14 has been updated forcibly by kgv.

SHA-1: 5d75b7d793b93547d0029960a14c75394ad341a8
(0095346)
kgv   
2020-09-25 20:21   
SendMessage processing a text message in report information message error message warning message
Tcl Exception: invalid command name "WriteMessageReport"

Test case doesn't pass.
(0095347)
git   
2020-09-25 20:22   
Branch CR29451_14 has been updated by kgv.

SHA-1: 1efafdd1d0229282282d61e2096fa6a2ff55934b


Detailed log of new commits:

Author: kgv
Date: Fri Sep 25 20:25:30 2020 +0300

    # add missing pload OCAF

(0095348)
git   
2020-09-25 20:34   
Branch CR29451_14 has been updated by kgv.

SHA-1: 9b915e965c9187fd81c6714f6d8edecd6907b0f8


Detailed log of new commits:

Author: kgv
Date: Fri Sep 25 20:36:59 2020 +0300

    # rename new Send() methods

(0095350)
git   
2020-09-25 21:20   
Branch CR29451_14 has been updated by kgv.

SHA-1: 8d1fe1c3dca7971b68ec985338d651272ab07802


Detailed log of new commits:

Author: kgv
Date: Fri Sep 25 21:23:48 2020 +0300

    # fix test case 2

(0095351)
abv   
2020-09-26 06:03   
Natalia, please reconsider some points:

1. Why adding new top-level test group "basic", for single test?? Consider adding it in existing group, e.g. "demo"

2. XmlDrivers_MessageReportStorage:
- why using XML format at all?? JSON looks more convenient, and already used for dumps
- why using OCAF at all for writing data to XML?? LDOM can be used directly, without contaminating the file with useless OCAF data
- why creating static instance of TDocStd_Application? Local instance will do the job
(0095454)
git   
2020-09-29 05:49   
Branch CR29451_14 has been updated by nds.

SHA-1: c8e44c8428a5c7372c5291b909d25f37084187d9


Detailed log of new commits:

Author: nds
Date: Tue Sep 29 05:53:07 2020 +0300

    remarks correction

(0095455)
git   
2020-09-29 06:22   
Branch CR29451_15 has been created by nds.

SHA-1: ef07a8e0eed4d7cefffdc2992ce82f01393e7e28


Detailed log of new commits:

Author: nds
Date: Thu Sep 24 17:54:55 2020 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality
(0095461)
git   
2020-09-29 12:28   
Branch CR29451_15 has been updated forcibly by nds.

SHA-1: 3ef7f111ad07ac1f709c312d84d399da5a9f4932
(0095470)
git   
2020-09-29 16:43   
Branch CR29451_15 has been updated forcibly by nds.

SHA-1: 21e69ba6351db67fed18df7b8f7247ede3cf35e4
(0095474)
nds   
2020-09-29 19:41   
(edited on: 2020-09-29 19:43)
Dear Andrey,
last points are processed:

1. creating of the "basic" test group is reverted, test is moved into "demo".

2. XmlDrivers_MessageReportStorage:
- issue 0031804 is reported to provide JSON type of storage (as alternative to the current)
- OCAF is used as native and simpliest way to store tree-like information. Also, to be able to store TopoDS_Shape content. Other OCAF format might be used here instead of XML. LDOM is also possible to be implemented as alternative (issue is not reported as functionality exists by OCAF now).
- static instance of TDocStd_Application is replaced to a local variable.

OCCT branch: CR29451_15,
products: NO.

Jenkins job: http://jenkins-test-12.nnov.opencascade.com/view/CR29451-master-nds/ [^]

Thank you for help, Natalia

(0095484)
nds   
2020-09-30 11:37   
Remove Xml report writer.
(0095495)
git   
2020-09-30 15:42   
Branch CR29451_15 has been updated by nds.

SHA-1: b95596a81bc1e72cca3b42c6d091e102f26cb2e1


Detailed log of new commits:

Author: nds
Date: Wed Sep 30 15:45:12 2020 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality
    
    XmlDrivers_MessageReportStorage is replaced by DumpJson of Message_Report.

(0095496)
git   
2020-09-30 15:46   
Branch CR29451_16 has been created by nds.

SHA-1: a48b97b9f75d60a1f5a6e2c5909f8d8db8bfbc05


Detailed log of new commits:

Author: nds
Date: Thu Sep 24 17:54:55 2020 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality
(0095500)
nds   
2020-09-30 15:59   
Dear Andrey,

remark concerning Json is fixed. Test covers this dump.
Please, review the issue once again.

Best regards, Natalia
(0095502)
git   
2020-09-30 17:55   
Branch CR29451_16 has been updated forcibly by nds.

SHA-1: 5a4a7ac9be2a71fab2e1fffc57cde7f70a04d7b6
(0095509)
kgv   
2020-09-30 22:19   
+  NCollection_DataMap<Message_MetricType, StartToStopValue> myMetrics; //!< computed metrics

...
+  const NCollection_Map<Message_MetricType>& anActiveMetrics = aReport->ActiveMetrics();

...
+  NCollection_Map<OSD_MemInfo::Counter> aCounters;

It looks like these maps are used in order-dependent outputs.
Using NCollection_IndexedDataMap would be more usable in this case.

+}
+//=======================================================================

Missing empty line.

+++ b/src/Message/Message_AttributeStream.hxx
+#include <NCollection_Vector.hxx>

Looks unused.

+  static Message_Level* MyLevel = 0;

Wouldn't NCollection_Shared<Message_Level> look better?

+  //! Assures stopping upon destruction
+  Standard_EXPORT ~Message_Level();
+
...
+protected:
+  //! Remove the current level from the report. It stops metric collecting for the last and the root 
alerts.
+  Standard_EXPORT void remove();

Consider either making destructor virtual (subclassing is supposed) or replacing `protected` with `private` (subclassing is unexpected).

-XmlDrivers_DocumentStorageDriver.hxx
+XmlDrivers_DocumentStorageDriver.hxx
\ No newline at end of file

Please revert unrelated change.
(0095510)
kgv   
2020-09-30 22:27   
(edited on: 2020-09-30 22:28)
+  Message_MetricType_UserTimeCPU,       //!< the current CPU user time in seconds
+  Message_MetricType_SystemTimeInfo,    //!< the current CPU system time in seconds
...
+    OSD_Chronometer::GetProcessCPU (aUserSeconds, aSystemSeconds);

These metrics fetch CPU times for all threads.
It would be better indicating this in metric name and description (referring to exact OSD_Chronometer method in description could be also useful).
Adding Thread metrics redirecting to OSD_Chronometer::GetThreadCPU() might be also useful (for measuring single-threaded algorithm or measuring a single thread within multi-threaded algorithm).

What about an estimated time (e.g. using OSD_Timer)?
Does it of no use for these reports / will be affected too much by report builder itself to provide precise values?

(0095511)
kgv   
2020-09-30 22:34   
0029451: Information Message Alert to debug an algorithm or object functionality

Commit description is too laconic - please put some description of added functionality into git commit.

+  //std::cout << GetName() << ": " << theValue << " (start)" 
<< std::endl;

Artifact to remove.

+  if (!HasMetric (theMetric))
+  {
+    myMetrics.Bind (theMetric, std::make_pair (theValue, UndefinedMetricValue()));
+  }
+  myMetrics.ChangeFind (theMetric).first = theValue;

if (T* aValPtr = myMetrics.ChangeSeek (theMetric))
{
  aValPtr->first = theValue;
}
else
{
  myMetrics.Bind (theMetric, std::make_pair (theValue, UndefinedMetricValue()));
}

(0095513)
abv   
2020-10-01 06:49   
Please provide description of the changes made (if possible, in terms of new features / possibilities introduced, with reference to relevant classes)
(0095578)
git   
2020-10-02 14:12   
Branch CR29451_16 has been updated by nds.

SHA-1: 821c81b0b8fd267a79a6aaab0a26801236e54b88


Detailed log of new commits:

Author: nds
Date: Fri Oct 2 14:15:44 2020 +0300

    remarks correction

(0095579)
git   
2020-10-02 14:14   
Branch CR29451_17 has been created by nds.

SHA-1: 17139421da00131bdf5368f4552895977488cfa7


Detailed log of new commits:

Author: nds
Date: Fri Oct 2 14:17:59 2020 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality
(0095581)
git   
2020-10-02 15:16   
Branch CR29451_17 has been updated forcibly by nds.

SHA-1: 1ba476b31db4e9a4d64c779e4cd49aa6345b05f3
(0095596)
git   
2020-10-02 18:06   
Branch CR29451_18 has been created by nds.

SHA-1: c123ddde509aedbadca12fe3b1a540ec54dd9d31


Detailed log of new commits:

Author: nds
Date: Fri Oct 2 14:17:59 2020 +0300

    0029451: Information Message Alert to debug an algorithm or object functionality
    
    - Added possibility to send stream information and transient object into Message_Messenger. Message_Printer will process it if needed.
    - Add Message_PrinterToReport to send messenger information into Message_Report.
    - Extended Message_Report to collect hierarchical alerts, to be able to collect some metrics during alerts processing.
    - Added Message_AlertExtended to prepare hierarchical alerts with custom attributes. One attribute for one alert.
    - Added Message_CompositeAlerts class to handle a container of alerts.
    - Added Message_Level to start a new hierarchical level by creating an instance, stop by destricting. This is an s-entry.
    - Added Message_Attribute and inheritors to store custom information about alert like object, stream, shape, some metrics.
    - Implement Message_AttributeAlert to collect start/stop information about active metrics of Message_Report. This kind of attribute is created if at least one metric is active in the report.
    - Add Message_MetricType enumeration with possible kinds of metrics in report.
    - Implement DumpJson for Message_Report to store all collected alerts into stream.
    - Added draw commands for Message_Report, Message_Messenger.
(0095599)
nds   
2020-10-02 18:20   
(edited on: 2020-10-02 18:37)
Dear Andrey,

please review.
For documentation extending for Message_Report using, issue 31818 is registered.

Jenkins job is: http://jenkins-test-12.nnov.opencascade.com/view/CR29451_18-master-nds/ [^]

Thank you for help, Natalia

(0095601)
git   
2020-10-02 18:39   
Branch CR29451_18 has been updated forcibly by nds.

SHA-1: e63c09b59fac95dfd47e9f4b7a7a6cf524a7f9ad
(0095604)
abv   
2020-10-02 21:41   
Reviewed, please integrate
(0095635)
bugmaster   
2020-10-03 14:04   
Combination -
OCCT branch : IR-2020-10-02
master SHA - 6522304c17181a09fa831c040219d611dc44b94a
a206de37fbfa0bf71bd534ae47192bbec23b8522
Products branch : IR-2020-10-02 SHA - d9c364e1137eed3249e5a05befa860c708f243c0
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 18085.050000000083 / 18057.60000000009 [+0.15%]
Products
Total CPU difference: 12174.620000000117 / 12124.200000000114 [+0.42%]
Windows-64-VC14:
OCCT
Total CPU difference: 19713.125 / 19772.65625 [-0.30%]
Products
Total CPU difference: 13533.8125 / 13527.921875 [+0.04%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
(0095643)
git   
2020-10-03 14:38   
Branch CR29451_18 has been deleted by inv.

SHA-1: e63c09b59fac95dfd47e9f4b7a7a6cf524a7f9ad
(0095645)
git   
2020-10-03 14:38   
Branch CR29451_17 has been deleted by inv.

SHA-1: 1ba476b31db4e9a4d64c779e4cd49aa6345b05f3
(0095646)
git   
2020-10-03 14:38   
Branch CR29451_16 has been deleted by inv.

SHA-1: 821c81b0b8fd267a79a6aaab0a26801236e54b88
(0095651)
git   
2020-10-03 14:38   
Branch CR29451_15 has been deleted by inv.

SHA-1: b95596a81bc1e72cca3b42c6d091e102f26cb2e1
(0095655)
git   
2020-10-03 14:38   
Branch CR29451_14 has been deleted by inv.

SHA-1: c8e44c8428a5c7372c5291b909d25f37084187d9
(0095664)
git   
2020-10-03 14:39   
Branch CR29451_13 has been deleted by inv.

SHA-1: 9af75d66b5c8924ce14cfbf5855f8f9fec8aa784
(0095667)
git   
2020-10-03 14:39   
Branch CR29451_13_31362 has been deleted by inv.

SHA-1: ab82998b4791fe1c107fee5633366a95b9030ee8
(0095670)
git   
2020-10-03 14:39   
Branch CR29451_12 has been deleted by inv.

SHA-1: 677e942292786e16258d61861b7ab7b4428897db
(0095671)
git   
2020-10-03 14:39   
Branch CR29451_10 has been deleted by inv.

SHA-1: d84b3c4d0db98a43cc075bef601183bb0a272ff9
(0095672)
git   
2020-10-03 14:39   
Branch CR29451_9 has been deleted by inv.

SHA-1: f36aa84ef8e8efa1ed6d12efabce1d4e6de940d1
(0095673)
git   
2020-10-03 14:39   
Branch CR29451_8 has been deleted by inv.

SHA-1: 907a45af595bc64be130ee9158217789788cfa50
(0095674)
git   
2020-10-03 14:39   
Branch CR29451_7 has been deleted by inv.

SHA-1: 2b52341e35876f55fb2a469d2da2da629abc0245
(0095675)
git   
2020-10-03 14:39   
Branch CR29451_6 has been deleted by inv.

SHA-1: 277b2d69fbbd1ccb641982205006e077e7ac8953
(0095676)
git   
2020-10-03 14:39   
Branch CR29451_5 has been deleted by inv.

SHA-1: 1f64bcf7813ab6bad61310ae6f19539d133f1ac4
(0095677)
git   
2020-10-03 14:39   
Branch CR29451_4 has been deleted by inv.

SHA-1: 572ee342a1aa2f30d3a77e56e49a5ab4e39dcd2d
(0095680)
git   
2020-10-03 14:39   
Branch CR29451_3 has been deleted by inv.

SHA-1: 9dae9d43ba992a094fb387648bcd5503b487f698
(0095681)
git   
2020-10-03 14:39   
Branch CR29451_2 has been deleted by inv.

SHA-1: e4529dcf83b12759e47efb89ded8207f802556a7
(0095682)
git   
2020-10-03 14:40   
Branch CR29451_1 has been deleted by inv.

SHA-1: 81cd71203e47f87527516014f2690f20ef5c25c8
(0095683)
git   
2020-10-03 14:40   
Branch CR29451 has been deleted by inv.

SHA-1: c5ec85b98925b56c42cba096c0747e821ef5eeea