mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-01 02:41:48 +00:00
Set up wpiformat
This commit is contained in:
committed by
Peter Johnson
parent
4514ff8071
commit
19f7a5f108
@@ -1,10 +1,17 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#include <chrono>
|
||||
#include <climits>
|
||||
#include <cstdio>
|
||||
#include <thread>
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
|
||||
#include "support/json.h"
|
||||
#include <support/json.h>
|
||||
|
||||
#include "ntcore.h"
|
||||
|
||||
@@ -33,7 +40,7 @@ int main() {
|
||||
|
||||
auto start2 = std::chrono::high_resolution_clock::now();
|
||||
auto start = nt::Now();
|
||||
for (int i=0; i<10000; ++i) {
|
||||
for (int i = 0; i < 10000; ++i) {
|
||||
unsigned int call1_uid = nt::CallRpc(entry, wpi::json::to_cbor(i));
|
||||
nt::GetRpcResult(entry, call1_uid, &call1_result_str);
|
||||
wpi::json call1_result;
|
||||
@@ -51,11 +58,17 @@ int main() {
|
||||
auto end2 = std::chrono::high_resolution_clock::now();
|
||||
auto end = nt::Now();
|
||||
std::cerr << "nt::Now start=" << start << " end=" << end << '\n';
|
||||
std::cerr << "std::chrono start=" <<
|
||||
std::chrono::duration_cast<std::chrono::nanoseconds>(start2.time_since_epoch()).count() << " end=" <<
|
||||
std::chrono::duration_cast<std::chrono::nanoseconds>(end2.time_since_epoch()).count() << '\n';
|
||||
std::fprintf(stderr, "time/call = %g us\n", (end-start) / 10.0 / 10000.0);
|
||||
std::chrono::duration<double, std::micro> diff = end2-start2;
|
||||
std::cerr << "std::chrono start="
|
||||
<< std::chrono::duration_cast<std::chrono::nanoseconds>(
|
||||
start2.time_since_epoch())
|
||||
.count()
|
||||
<< " end="
|
||||
<< std::chrono::duration_cast<std::chrono::nanoseconds>(
|
||||
end2.time_since_epoch())
|
||||
.count()
|
||||
<< '\n';
|
||||
std::fprintf(stderr, "time/call = %g us\n", (end - start) / 10.0 / 10000.0);
|
||||
std::chrono::duration<double, std::micro> diff = end2 - start2;
|
||||
std::cerr << "time/call = " << (diff.count() / 10000.0) << " us\n";
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user