2012-09-07 15:21:18 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2012 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "bench/BenchLogger.h"
|
2014-06-19 19:32:29 +00:00
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkStream.h"
|
2012-09-07 15:21:18 +00:00
|
|
|
|
2014-06-19 19:32:29 +00:00
|
|
|
BenchLogger::BenchLogger()
|
2015-08-27 14:41:13 +00:00
|
|
|
: fFileStream(nullptr) {}
|
2012-09-07 15:21:18 +00:00
|
|
|
|
2014-06-19 19:32:29 +00:00
|
|
|
BenchLogger::~BenchLogger() {
|
2012-09-07 15:21:18 +00:00
|
|
|
if (fFileStream) {
|
2015-08-26 20:07:48 +00:00
|
|
|
delete fFileStream;
|
2012-09-07 15:21:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-19 19:32:29 +00:00
|
|
|
bool BenchLogger::SetLogFile(const char *file) {
|
2015-08-26 20:07:48 +00:00
|
|
|
fFileStream = new SkFILEWStream(file);
|
2012-09-07 15:21:18 +00:00
|
|
|
return fFileStream->isValid();
|
|
|
|
}
|
|
|
|
|
2014-06-19 19:32:29 +00:00
|
|
|
void BenchLogger::fileWrite(const char msg[], size_t size) {
|
2012-09-07 15:21:18 +00:00
|
|
|
if (fFileStream && fFileStream->isValid()) {
|
|
|
|
fFileStream->write(msg, size);
|
|
|
|
}
|
|
|
|
}
|