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

Side by Side Diff: test/perf.cc

Issue 658573004: Updating to new OTS repo from https://github.com/khaledhosny/ots.git (Closed) Base URL: https://chromium.googlesource.com/external/ots@master
Patch Set: Adding Colored Emoji changes from external/git repo Created 6 years, 2 months 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <fcntl.h> 5 #include <fcntl.h>
6 #include <sys/stat.h> 6 #include <sys/stat.h>
7 #include <sys/time.h> // for timersub macro. 7 #include <sys/time.h>
8 #include <unistd.h> 8 #include <unistd.h>
9 #include <time.h> 9 #include <time.h>
10 10
11 #include <cstdio> 11 #include <cstdio>
12 #include <cstdlib> 12 #include <cstdlib>
13 #include <cstring> 13 #include <cstring>
14 14
15 #include "opentype-sanitiser.h" 15 #include "opentype-sanitiser.h"
16 #include "ots-memory-stream.h" 16 #include "ots-memory-stream.h"
17 17
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 num_repeat = 2500; 55 num_repeat = 2500;
56 } 56 }
57 if (st.st_size < 1024 * 100) { 57 if (st.st_size < 1024 * 100) {
58 num_repeat = 5000; 58 num_repeat = 5000;
59 } 59 }
60 60
61 struct timeval start, end, elapsed; 61 struct timeval start, end, elapsed;
62 ::gettimeofday(&start, 0); 62 ::gettimeofday(&start, 0);
63 for (int i = 0; i < num_repeat; ++i) { 63 for (int i = 0; i < num_repeat; ++i) {
64 ots::MemoryStream output(result, st.st_size + kPadLen); 64 ots::MemoryStream output(result, st.st_size + kPadLen);
65 bool r = ots::Process(&output, data, st.st_size); 65 ots::OTSContext context;
66 bool r = context.Process(&output, data, st.st_size);
66 if (!r) { 67 if (!r) {
67 std::fprintf(stderr, "Failed to sanitise file!\n"); 68 std::fprintf(stderr, "Failed to sanitise file!\n");
68 return 1; 69 return 1;
69 } 70 }
70 } 71 }
71 ::gettimeofday(&end, 0); 72 ::gettimeofday(&end, 0);
72 timersub(&end, &start, &elapsed); 73 timersub(&end, &start, &elapsed);
73 74
74 long long unsigned us 75 long long unsigned us
75 = ((elapsed.tv_sec * 1000 * 1000) + elapsed.tv_usec) / num_repeat; 76 = ((elapsed.tv_sec * 1000 * 1000) + elapsed.tv_usec) / num_repeat;
76 std::fprintf(stderr, "%llu [us] %s (%llu bytes, %llu [byte/us])\n", 77 std::fprintf(stderr, "%llu [us] %s (%llu bytes, %llu [byte/us])\n",
77 us, argv[1], static_cast<long long>(st.st_size), 78 us, argv[1], static_cast<long long>(st.st_size),
78 (us ? st.st_size / us : 0)); 79 (us ? st.st_size / us : 0));
79 80
80 return 0; 81 return 0;
81 } 82 }
OLDNEW
« .gitmodules ('K') | « test/ot-sanitise.cc ('k') | test/side-by-side.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698