[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 77626be 2/5: Streamline temporary instrumenta
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 77626be 2/5: Streamline temporary instrumentation |
Date: |
Thu, 2 Apr 2020 19:47:20 -0400 (EDT) |
branch: master
commit 77626be8dc06ae6b6cab0acbdf87ebecf4b90c63
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Streamline temporary instrumentation
Don't measure the time it takes to authenticate using an external
binary, because internal routines are always preferable. For now,
use first one of these commands, then the other
wine ./lmi_wx_shared --data_path=/opt/lmi/data
wine ./lmi_wx_shared --data_path=/opt/lmi/data --pyx=measure_md5
to run some scenario like
File | New | Illustration
OK
File | Print to PDF
and compare the elapsed time shown on the statusbar, to see the cost
of reauthenticating before generating each PDF.
On my machine, running under 'wine', I see:
341 msec without '--pyx=measure_md5'
405 msec with '--pyx=measure_md5'
and (405-341)/341 is about a twenty-percent penalty.
---
authenticity.cpp | 64 +++++---------------------------------------------------
1 file changed, 5 insertions(+), 59 deletions(-)
diff --git a/authenticity.cpp b/authenticity.cpp
index 46e3c24..d26cd65 100644
--- a/authenticity.cpp
+++ b/authenticity.cpp
@@ -31,8 +31,6 @@
#include "md5.hpp"
#include "md5sum.hpp"
#include "path_utility.hpp" // fs::path inserter
-#include "platform_dependent.hpp" // chdir()
-#include "system_command.hpp"
#include "timer.hpp"
#include <boost/filesystem/fstream.hpp>
@@ -81,6 +79,7 @@ std::string Authenticity::Assay
if
( calendar_date(jdn_t(0)) != Instance().CachedDate_
&& candidate == Instance().CachedDate_
+ // MD5 !! Revert "measure_md5" instrumentation soon.
&& !contains(global_settings::instance().pyx(), "measure_md5")
)
{
@@ -249,63 +248,10 @@ std::string Authenticity::Assay
// Cache the validated date.
Instance().CachedDate_ = candidate;
- std::cout << "Assay: production " << timer.stop().elapsed_msec_str() <<
std::endl;
-
- // MD5 !! Revert "measure_md5" instrumentation soon.
- if(contains(global_settings::instance().pyx(), "measure_md5"))
- {
- try
- {
- timer.restart();
- fs::path original_path(fs::current_path());
- if(0 != chdir(data_path.string().c_str()))
- {
- oss
- << "Unable to change directory to '"
- << data_path
- << "'. Try reinstalling."
- ;
- return oss.str();
- }
- system_command("md5sum --check --status " + (data_path /
md5sum_file()).string());
- if(0 != chdir(original_path.string().c_str()))
- {
- oss
- << "Unable to restore directory to '"
- << original_path
- << "'. Try reinstalling."
- ;
- return oss.str();
- }
- std::cout << "Assay: external program " <<
timer.stop().elapsed_msec_str() << std::endl;
-
- timer.restart();
- auto const sums = md5_read_checksum_file(data_path / md5sum_file());
- for(auto const& s : sums)
- {
- auto const file_path = data_path / s.filename;
- auto const md5 = md5_calculate_file_checksum
- (data_path / s.filename
- ,s.file_mode
- );
- if(md5 != s.md5sum)
- {
- throw std::runtime_error
- ( "Integrity check failed for '"
- + s.filename.string()
- + "'"
- );
- }
- }
- std::cout << "Assay: internal " << timer.stop().elapsed_msec_str() <<
std::endl;
- }
- catch(...)
- {
- report_exception();
- oss << "Failure in time measurements.";
- return oss.str();
- }
- }
+ // MD5 !! Revert "measure_md5" instrumentation soon. Use
+ // git diff c029dd3248 authenticity.cpp
+ // to see whether reversion is complete.
+ std::cout << "authentication: " << timer.stop().elapsed_msec_str() <<
std::endl;
return "validated";
}
- [lmi-commits] [lmi] master updated (6425b3b -> d5474d7), Greg Chicares, 2020/04/02
- [lmi-commits] [lmi] master e2db549 1/5: Resolve gratuitous differences, Greg Chicares, 2020/04/02
- [lmi-commits] [lmi] master 8b8a660 3/5: Augment 'show_env' makefile target, exposing a defect, Greg Chicares, 2020/04/02
- [lmi-commits] [lmi] master a034d7f 4/5: Fix defect exposed 20200402T1125Z: 'make' subtlety, Greg Chicares, 2020/04/02
- [lmi-commits] [lmi] master 77626be 2/5: Streamline temporary instrumentation,
Greg Chicares <=
- [lmi-commits] [lmi] master d5474d7 5/5: Reorder makefile, preferring $(srcdir) to $(CURDIR), Greg Chicares, 2020/04/02