mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Remove the systrace logger. Dart can now redirect traces to systrace. (flutter/engine#3057)
This commit is contained in:
parent
b2e97acdb8
commit
eab36e0efe
@ -34,8 +34,6 @@ source_set("common") {
|
||||
"shell.h",
|
||||
"switches.cc",
|
||||
"switches.h",
|
||||
"systrace_logger.cc",
|
||||
"systrace_logger.h",
|
||||
"tracing_controller.cc",
|
||||
"tracing_controller.h",
|
||||
"ui_delegate.cc",
|
||||
|
||||
@ -1,55 +0,0 @@
|
||||
// Copyright 2016 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "flutter/shell/common/systrace_logger.h"
|
||||
|
||||
#include "lib/ftl/files/eintr_wrapper.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace shell {
|
||||
|
||||
static const int kBufferSize = 256;
|
||||
|
||||
SystraceLogger::SystraceLogger()
|
||||
: trace_fd_(HANDLE_EINTR(
|
||||
::open("/sys/kernel/debug/tracing/trace_marker", O_WRONLY))),
|
||||
pid_(getpid()) {}
|
||||
|
||||
SystraceLogger::~SystraceLogger() {
|
||||
IGNORE_EINTR(::close(trace_fd_));
|
||||
}
|
||||
|
||||
void SystraceLogger::TraceBegin(const char* label) const {
|
||||
char buffer[kBufferSize];
|
||||
int buffer_written = snprintf(buffer, sizeof(buffer), "B|%d|%s", pid_, label);
|
||||
|
||||
if (buffer_written <= 0 || buffer_written > kBufferSize) {
|
||||
return;
|
||||
}
|
||||
|
||||
HANDLE_EINTR(::write(trace_fd_, buffer, buffer_written));
|
||||
}
|
||||
|
||||
void SystraceLogger::TraceEnd() const {
|
||||
HANDLE_EINTR(::write(trace_fd_, "E", 1));
|
||||
}
|
||||
|
||||
void SystraceLogger::TraceCount(const char* label, int count) const {
|
||||
char buffer[kBufferSize];
|
||||
|
||||
int buffer_written =
|
||||
snprintf(buffer, sizeof(buffer), "C|%d|%s|%d", pid_, label, count);
|
||||
|
||||
if (buffer_written <= 0 || buffer_written > kBufferSize) {
|
||||
return;
|
||||
}
|
||||
|
||||
HANDLE_EINTR(::write(trace_fd_, buffer, buffer_written));
|
||||
}
|
||||
|
||||
} // namespace shell
|
||||
@ -1,35 +0,0 @@
|
||||
// Copyright 2016 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SHELL_COMMON_SYSTRACE_LOGGER_H_
|
||||
#define SHELL_COMMON_SYSTRACE_LOGGER_H_
|
||||
|
||||
#include "lib/ftl/macros.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
namespace shell {
|
||||
|
||||
class SystraceLogger {
|
||||
public:
|
||||
SystraceLogger();
|
||||
|
||||
~SystraceLogger();
|
||||
|
||||
void TraceBegin(const char* label) const;
|
||||
|
||||
void TraceEnd() const;
|
||||
|
||||
void TraceCount(const char* label, int count) const;
|
||||
|
||||
private:
|
||||
int trace_fd_;
|
||||
int pid_;
|
||||
|
||||
FTL_DISALLOW_COPY_AND_ASSIGN(SystraceLogger);
|
||||
};
|
||||
|
||||
} // namespace shell
|
||||
|
||||
#endif // SHELL_COMMON_SYSTRACE_LOGGER_H_
|
||||
Loading…
x
Reference in New Issue
Block a user