-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add stats tracking using CVal for starboard storage and file writes f…
…rom cobalt. b/277761317 Change-Id: Iabc8bf97772cfa42d9f0f0425eeef91376e4044d
- Loading branch information
1 parent
94eb6d7
commit b8c6180
Showing
42 changed files
with
641 additions
and
449 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
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,67 @@ | ||
// Copyright 2023 The Cobalt Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef COBALT_BASE_STARBOARD_STATS_TRACKER_H_ | ||
#define COBALT_BASE_STARBOARD_STATS_TRACKER_H_ | ||
|
||
#include "cobalt/base/c_val.h" | ||
#include "starboard_stats/stats_tracker.h" | ||
|
||
class StarboardStatsTracker : public starboard_stats::StatsTracker { | ||
public: | ||
StarboardStatsTracker() | ||
: file_write_success_("Starboard.FileWrite.Success", 0, | ||
"SbFileWrite() success count from cobalt."), | ||
file_write_fail_("Starboard.FileWrite.Fail", 0, | ||
"SbFileWrite() fail count from cobalt."), | ||
file_write_bytes_written_("Starboard.FileWrite.BytesWritten", 0, | ||
"SbFileWrite() bytes written from cobalt."), | ||
storage_write_record_success_( | ||
"Starboard.StorageWriteRecord.Success", 0, | ||
"SbStorageWriteRecord() success count from cobalt."), | ||
storage_write_record_fail_( | ||
"Starboard.StorageWriteRecord.Fail", 0, | ||
"SbStorageWriteRecord() fail count from cobalt."), | ||
storage_write_record_bytes_written_( | ||
"Starboard.StorageWriteRecord.BytesWritten", 0, | ||
"SbStorageWriteRecord() bytes written from cobalt.") {} | ||
|
||
void FileWriteSuccess() override { ++file_write_success_; } | ||
|
||
void FileWriteFail() override { ++file_write_fail_; } | ||
|
||
void FileWriteBytesWritten(int bytes_written) override { | ||
file_write_bytes_written_ += bytes_written; | ||
} | ||
|
||
void StorageWriteRecordSuccess() override { ++storage_write_record_success_; } | ||
|
||
void StorageWriteRecordFail() override { ++storage_write_record_fail_; } | ||
|
||
void StorageWriteRecordBytesWritten(int bytes_written) override { | ||
storage_write_record_bytes_written_ += bytes_written; | ||
} | ||
|
||
private: | ||
base::CVal<int, base::CValPublic> file_write_success_; | ||
base::CVal<int, base::CValPublic> file_write_fail_; | ||
base::CVal<base::cval::SizeInBytes, base::CValPublic> | ||
file_write_bytes_written_; | ||
base::CVal<int, base::CValPublic> storage_write_record_success_; | ||
base::CVal<int, base::CValPublic> storage_write_record_fail_; | ||
base::CVal<base::cval::SizeInBytes, base::CValPublic> | ||
storage_write_record_bytes_written_; | ||
}; | ||
|
||
#endif // COBALT_BASE_STARBOARD_STATS_TRACKER_H_ |
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
Oops, something went wrong.