[Pkg-running-devel] [antpm] 28/31: antpm: measure download times
Kristof Ralovich
ralovich-guest at moszumanska.debian.org
Fri Mar 24 23:19:39 UTC 2017
This is an automated email from the git hooks/post-receive script.
ralovich-guest pushed a commit to branch master
in repository antpm.
commit cc1d5f018e57163d77500fbf9a18c33fa7450f18
Author: RALOVICH, Kristof <tade60 at freemail.hu>
Date: Fri Mar 24 18:49:34 2017 +0100
antpm: measure download times
---
src/AntFr310XT.cpp | 21 ++++++++++++++++++---
src/DeviceSettings.cpp | 2 ++
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/src/AntFr310XT.cpp b/src/AntFr310XT.cpp
index 107fadb..ff09617 100644
--- a/src/AntFr310XT.cpp
+++ b/src/AntFr310XT.cpp
@@ -30,6 +30,7 @@
#include <algorithm>
#include <vector>
#include <string>
+#include <chrono>
#include <boost/thread/thread_time.hpp>
#include <iostream>
#include "stdintfwd.hpp"
@@ -612,13 +613,19 @@ AntFr310XT::handleEvents()
<< "@" << DeviceSettings::time2str(t) << " newer than "
<< DeviceSettings::time2str(m_ds->LastTransferredTime) << "\n";
+ auto start = std::chrono::system_clock::now();
+
std::vector<uchar> data;
if(!m_antMessenger->ANTFS_Download(chan, fileIdx, data))
{
changeStateSafe(ST_ANTFS_LAST);
return true;
}
- LOG(LOG_RAW) << "\n\nDownloaded file idx=" << toString<ushort>(fileIdx,4,'0') << "\n\n\n";
+
+ auto end = std::chrono::system_clock::now();
+ auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
+ LOG(LOG_RAW) << "\n\nDownloaded file idx=" << toString<ushort>(fileIdx,4,'0') << " (" << elapsed.count() << " ms, "
+ << static_cast<double>(data.size())/static_cast<double>(elapsed.count())*1000.0 << " bps)\n\n\n";
AntFsFile file0; file0.bytes=data; file0.saveToFile((folder+toString(fileIdx, 4, '0')+".fit").c_str());
//LOG_VAR(file0.checkCrc());
@@ -650,13 +657,17 @@ AntFr310XT::handleEvents()
<< "@" << DeviceSettings::time2str(t) << " newer than "
<< DeviceSettings::time2str(m_ds->LastTransferredTime) << "\n";
+ auto start = std::chrono::system_clock::now();
std::vector<uchar> data;
if(!m_antMessenger->ANTFS_Download(chan, fileIdx, data))
{
changeStateSafe(ST_ANTFS_LAST);
return true;
}
- LOG(LOG_RAW) << "\n\nDownloaded file idx=" << toString<ushort>(fileIdx,4,'0') << "\n\n\n";
+ auto end = std::chrono::system_clock::now();
+ auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
+ LOG(LOG_RAW) << "\n\nDownloaded file idx=" << toString<ushort>(fileIdx,4,'0') << " (" << elapsed.count() << " ms, "
+ << static_cast<double>(data.size())/static_cast<double>(elapsed.count())*1000.0 << " bps)\n\n\n";
AntFsFile file0; file0.bytes=data; file0.saveToFile((folder+toString(fileIdx, 4, '0')+".fit").c_str());
fit.parse(data, gpx);
@@ -695,13 +706,17 @@ AntFr310XT::handleEvents()
<< "@" << DeviceSettings::time2str(t) << " newer than "
<< DeviceSettings::time2str(m_ds->LastTransferredTime) << "\n";
+ auto start = std::chrono::system_clock::now();
std::vector<uchar> data;
if(!m_antMessenger->ANTFS_Download(chan, fileIdx, data))
{
changeStateSafe(ST_ANTFS_LAST);
return true;
}
- LOG(LOG_RAW) << "\n\nDownloaded file idx=" << toString<ushort>(fileIdx,4,'0') << "\n\n\n";
+ auto end = std::chrono::system_clock::now();
+ auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);
+ LOG(LOG_RAW) << "\n\nDownloaded file idx=" << toString<ushort>(fileIdx,4,'0') << " (" << elapsed.count() << " ms, "
+ << static_cast<double>(data.size())/static_cast<double>(elapsed.count())*1000.0 << " bps)\n\n\n";
AntFsFile file0; file0.bytes=data; file0.saveToFile((folder+toString(fileIdx, 4, '0')+".fit").c_str());
fit.parse(data, gpx);
diff --git a/src/DeviceSettings.cpp b/src/DeviceSettings.cpp
index d8caee0..f28b975 100644
--- a/src/DeviceSettings.cpp
+++ b/src/DeviceSettings.cpp
@@ -113,6 +113,8 @@ DeviceSettings::getDatabaseFiles(size_t count) const
{
continue;
}
+ // std::cout << "\t0x" << toString<uint16_t>(value,4,'0') << " "
+ // << fs::file_size(fit.path()) << " " << fit.path().string() << std::endl;
files.insert(DatabaseEntity(static_cast<uint16_t>(value),
FITEntity(fit.path().string(), fs::file_size(fit.path()))));
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-running/antpm.git
More information about the Pkg-running-devel
mailing list