-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added C++ Version of trace collection shell script.
PiperOrigin-RevId: 265996122
- Loading branch information
1 parent
ca15ffb
commit fb9bd67
Showing
9 changed files
with
802 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
load("@rules_cc//cc:defs.bzl", "cc_binary") | ||
|
||
package(default_visibility = ["//visibility:public"]) | ||
|
||
licenses(["notice"]) # Apache License 2.0 | ||
|
||
cc_binary( | ||
name = "trace", | ||
srcs = [ | ||
"status.h", | ||
"trace.cc", | ||
"trace.h", | ||
], | ||
copts = ["-std=c++17"], | ||
linkopts = ["-lc++fs"], | ||
deps = [ | ||
"@com_google_absl//absl/base:core_headers", | ||
"@com_google_absl//absl/flags:flag", | ||
"@com_google_absl//absl/flags:parse", | ||
"@com_google_absl//absl/strings", | ||
"@com_google_absl//absl/time", | ||
"@com_googlesource_code_re2//:re2", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#ifndef SCHEDVIZ_UTIL_STATUS_H_ | ||
#define SCHEDVIZ_UTIL_STATUS_H_ | ||
|
||
#include <string> | ||
|
||
#include "absl/base/attributes.h" | ||
#include "absl/strings/string_view.h" | ||
|
||
enum class StatusCode : int { | ||
kOk = 0, | ||
kInternal = 13, | ||
}; | ||
|
||
class ABSL_MUST_USE_RESULT Status final { | ||
StatusCode code_; | ||
std::string message_; | ||
|
||
Status(StatusCode code, absl::string_view message) | ||
: code_(code), message_(message) {} | ||
|
||
public: | ||
Status() : code_(StatusCode::kOk), message_("") {} | ||
|
||
inline static Status InternalError(absl::string_view msg) { | ||
return Status(StatusCode::kInternal, msg); | ||
} | ||
|
||
inline static Status OkStatus() { return Status(); } | ||
|
||
StatusCode code() const { return code_; } | ||
|
||
ABSL_MUST_USE_RESULT bool ok() const { return code_ == StatusCode::kOk; } | ||
|
||
absl::string_view message() const { return message_; } | ||
}; | ||
|
||
#endif // SCHEDVIZ_UTIL_STATUS_H_ |
Oops, something went wrong.