Log time for loading fonts

This commit is contained in:
Filip Sykala - NTB T15p 2022-10-13 15:05:28 +02:00
parent ce71144c7c
commit fe90a88b4d
3 changed files with 29 additions and 2 deletions

View File

@ -34,6 +34,7 @@
#include <wx/fontenum.h>
#include <GL/glew.h>
#include <chrono> // measure enumeration of fonts
// uncomment for easier debug
//#define ALLOW_DEBUG_MODE
@ -1294,7 +1295,18 @@ void GLGizmoEmboss::init_face_names() {
wxFontEncoding encoding = wxFontEncoding::wxFONTENCODING_SYSTEM;
MyFontEnumerator fontEnumerator(encoding);
bool fixed_width_only = false;
{ using namespace std::chrono;
steady_clock::time_point enumerate_start = steady_clock::now();
ScopeGuard sg([&enumerate_start]() {
steady_clock::time_point enumerate_end = steady_clock::now();
long long enumerate_duration = duration_cast<milliseconds>(enumerate_end - enumerate_start).count();
BOOST_LOG_TRIVIAL(info) << "OS Fonts Enumeration " << enumerate_duration << "ms";
});
fontEnumerator.EnumerateFacenames(encoding, fixed_width_only);
}// End Time measures
m_face_names.encoding = encoding;
std::vector<wxString> &names = fontEnumerator.m_facenames;
std::sort(names.begin(), names.end());

View File

@ -9,6 +9,8 @@
#include "wx/fontenum.h"
#include <boost/log/trivial.hpp>
using namespace Slic3r;
using namespace Slic3r::GUI;
@ -96,6 +98,11 @@ void CreateFontImageJob::process(Ctl &ctl)
r->encode(encoder);
}
// ability to request new frame after finish rendering
#include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/Plater.hpp"
#include "slic3r/GUI/GLCanvas3D.hpp"
void CreateFontImageJob::finalize(bool canceled, std::exception_ptr &)
{
if (m_input.count_opened_font_files)
@ -118,4 +125,12 @@ void CreateFontImageJob::finalize(bool canceled, std::exception_ptr &)
// bind default texture
GLuint no_texture_id = 0;
glsafe(::glBindTexture(target, no_texture_id));
// show rendered texture
//wxGetApp().plater()->get_current_canvas3D()->schedule_extra_frame(0);
BOOST_LOG_TRIVIAL(info)
<< "Generate Preview font('" << m_input.font_name << "' id:" << m_input.index << ") "
<< "with text: '" << m_input.text << "' "
<< "texture_size " << m_input.size.x() << " x " << m_input.size.y();
}

View File

@ -77,7 +77,7 @@ class PlaterWorker: public Worker {
<< std::fixed // do not use scientific notations
<< "Job '" << typeid(*m_job).name() << "' "
<< "spend " << m_process_duration + finalize_duration << "ms "
<< "(process " << m_process_duration << "ms + finalize " << finalize_duration << "ms)" << std::endl;
<< "(process " << m_process_duration << "ms + finalize " << finalize_duration << "ms)";
if (eptr) try {
std::rethrow_exception(eptr);