File size: 1,817 Bytes
9c6594c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
#include <string>
// Stages in libkineto used when pushing logs to UST Logger.
constexpr char kWarmUpStage[] = "Warm Up";
constexpr char kCollectionStage[] = "Collection";
constexpr char kPostProcessingStage[] = "Post Processing";
// Special string in UST for determining if traces are empty
constexpr char kEmptyTrace[] =
"No Valid Trace Events (CPU/GPU) found. Outputting empty trace.";
#if !USE_GOOGLE_LOG
#include <map>
#include <vector>
#include <stdint.h>
namespace libkineto {
enum LoggerOutputType {
VERBOSE = 0,
INFO = 1,
WARNING = 2,
STAGE = 3,
ERROR = 4,
ENUM_COUNT = 5
};
const char* toString(LoggerOutputType t);
LoggerOutputType toLoggerOutputType(const std::string& str);
constexpr int LoggerTypeCount = (int)LoggerOutputType::ENUM_COUNT;
class ILoggerObserver {
public:
virtual ~ILoggerObserver() = default;
virtual void write(const std::string& message, LoggerOutputType ot) = 0;
virtual const std::map<LoggerOutputType, std::vector<std::string>>
extractCollectorMetadata() = 0;
virtual void reset() = 0;
virtual void addDevice(const int64_t device) = 0;
virtual void setTraceDurationMS(const int64_t duration) = 0;
virtual void addEventCount(const int64_t count) = 0;
virtual void setTraceID(const std::string&) {}
virtual void setGroupTraceID(const std::string&) {}
virtual void addDestination(const std::string& dest) = 0;
virtual void setTriggerOnDemand() {}
virtual void addMetadata(
const std::string& key,
const std::string& value) = 0;
};
} // namespace libkineto
#endif // !USE_GOOGLE_LOG
|