xref: /aosp_15_r20/external/tensorflow/tensorflow/tsl/platform/default/crash_analysis.h (revision b6fb3261f9314811a0f4371741dbb8839866f948)
1 /* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
2 
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6 
7     http://www.apache.org/licenses/LICENSE-2.0
8 
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ==============================================================================*/
15 
16 #ifndef TENSORFLOW_CORE_PLATFORM_DEFAULT_CRASH_ANALYSIS_H_
17 #define TENSORFLOW_CORE_PLATFORM_DEFAULT_CRASH_ANALYSIS_H_
18 
19 #include <string>
20 
21 #include "tensorflow/core/platform/protobuf.h"
22 
23 namespace tensorflow {
24 namespace crash_analysis {
25 
26 class BufferedDataSource {};
27 
28 // Reports `message` proto which will be stored in the `file_name` in case
29 // of a process crash.
30 // Default implementation is currently NOOP.
31 BufferedDataSource* ReportProtoDataOnCrash(const std::string& file_name,
32                                            const protobuf::Message& message);
33 
34 // Removes `data_source` from the list of data reported in case of a process
35 // crash.
36 // Default implementation is currently NOOP.
37 void RemoveReportData(const BufferedDataSource* data_source);
38 
39 // Reports `event_data` with the associated `message` under `event_name` to the
40 // crash analysis system. This does not require process crash.
41 // Default implementation is currently NOOP.
42 void ReportEvent(const std::string& event_name, const std::string& message,
43                  const std::string& event_data);
44 
45 }  // namespace crash_analysis
46 }  // namespace tensorflow
47 
48 #endif  // TENSORFLOW_CORE_PLATFORM_DEFAULT_CRASH_ANALYSIS_H_
49