Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Unified Diff: third_party/ots/test/perf.cc

Issue 797183002: Revert of Updating OTS repo from https://github.com/khaledhosny/ots.git (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/ots/test/ot-sanitise.cc ('k') | third_party/ots/test/side-by-side.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/ots/test/perf.cc
diff --git a/third_party/ots/test/perf.cc b/third_party/ots/test/perf.cc
deleted file mode 100644
index de7ee4145a5748b00e0469d7c14d4b61bb051260..0000000000000000000000000000000000000000
--- a/third_party/ots/test/perf.cc
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (c) 2009 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 <fcntl.h>
-#include <sys/stat.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <time.h>
-
-#include <cstdio>
-#include <cstdlib>
-#include <cstring>
-
-#include "opentype-sanitiser.h"
-#include "ots-memory-stream.h"
-
-namespace {
-
-int Usage(const char *argv0) {
- std::fprintf(stderr, "Usage: %s <ttf file>\n", argv0);
- return 1;
-}
-
-} // namespace
-
-int main(int argc, char **argv) {
- if (argc != 2) return Usage(argv[0]);
-
- const int fd = ::open(argv[1], O_RDONLY);
- if (fd < 0) {
- ::perror("open");
- return 1;
- }
-
- struct stat st;
- ::fstat(fd, &st);
-
- uint8_t *data = new uint8_t[st.st_size];
- if (::read(fd, data, st.st_size) != st.st_size) {
- std::fprintf(stderr, "Failed to read file!\n");
- return 1;
- }
-
- // A transcoded font is usually smaller than an original font.
- // However, it can be slightly bigger than the original one due to
- // name table replacement and/or padding for glyf table.
- static const size_t kPadLen = 20 * 1024;
- uint8_t *result = new uint8_t[st.st_size + kPadLen];
-
- int num_repeat = 250;
- if (st.st_size < 1024 * 1024) {
- num_repeat = 2500;
- }
- if (st.st_size < 1024 * 100) {
- num_repeat = 5000;
- }
-
- struct timeval start, end, elapsed;
- ::gettimeofday(&start, 0);
- for (int i = 0; i < num_repeat; ++i) {
- ots::MemoryStream output(result, st.st_size + kPadLen);
- ots::OTSContext context;
- bool r = context.Process(&output, data, st.st_size);
- if (!r) {
- std::fprintf(stderr, "Failed to sanitise file!\n");
- return 1;
- }
- }
- ::gettimeofday(&end, 0);
- timersub(&end, &start, &elapsed);
-
- long long unsigned us
- = ((elapsed.tv_sec * 1000 * 1000) + elapsed.tv_usec) / num_repeat;
- std::fprintf(stderr, "%llu [us] %s (%llu bytes, %llu [byte/us])\n",
- us, argv[1], static_cast<long long>(st.st_size),
- (us ? st.st_size / us : 0));
-
- return 0;
-}
« no previous file with comments | « third_party/ots/test/ot-sanitise.cc ('k') | third_party/ots/test/side-by-side.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698