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.
|
|
|
|
*/
|
|
|
|
|
2014-06-19 19:32:29 +00:00
|
|
|
#include "BenchLogger.h"
|
|
|
|
|
2012-09-07 15:21:18 +00:00
|
|
|
#include "SkStream.h"
|
|
|
|
|
2014-06-19 19:32:29 +00:00
|
|
|
BenchLogger::BenchLogger()
|
2012-09-07 15:21:18 +00:00
|
|
|
: fFileStream(NULL) {}
|
|
|
|
|
2014-06-19 19:32:29 +00:00
|
|
|
BenchLogger::~BenchLogger() {
|
2012-09-07 15:21:18 +00:00
|
|
|
if (fFileStream) {
|
|
|
|
SkDELETE(fFileStream);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-19 19:32:29 +00:00
|
|
|
bool BenchLogger::SetLogFile(const char *file) {
|
2012-09-07 15:21:18 +00:00
|
|
|
fFileStream = SkNEW_ARGS(SkFILEWStream, (file));
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|