Log time for loading fonts
This commit is contained in:
parent
ce71144c7c
commit
fe90a88b4d
3 changed files with 29 additions and 2 deletions
|
@ -34,6 +34,7 @@
|
||||||
#include <wx/fontenum.h>
|
#include <wx/fontenum.h>
|
||||||
|
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
|
#include <chrono> // measure enumeration of fonts
|
||||||
|
|
||||||
// uncomment for easier debug
|
// uncomment for easier debug
|
||||||
//#define ALLOW_DEBUG_MODE
|
//#define ALLOW_DEBUG_MODE
|
||||||
|
@ -1294,7 +1295,18 @@ void GLGizmoEmboss::init_face_names() {
|
||||||
wxFontEncoding encoding = wxFontEncoding::wxFONTENCODING_SYSTEM;
|
wxFontEncoding encoding = wxFontEncoding::wxFONTENCODING_SYSTEM;
|
||||||
MyFontEnumerator fontEnumerator(encoding);
|
MyFontEnumerator fontEnumerator(encoding);
|
||||||
bool fixed_width_only = false;
|
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);
|
fontEnumerator.EnumerateFacenames(encoding, fixed_width_only);
|
||||||
|
}// End Time measures
|
||||||
|
|
||||||
m_face_names.encoding = encoding;
|
m_face_names.encoding = encoding;
|
||||||
std::vector<wxString> &names = fontEnumerator.m_facenames;
|
std::vector<wxString> &names = fontEnumerator.m_facenames;
|
||||||
std::sort(names.begin(), names.end());
|
std::sort(names.begin(), names.end());
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
#include "wx/fontenum.h"
|
#include "wx/fontenum.h"
|
||||||
|
|
||||||
|
#include <boost/log/trivial.hpp>
|
||||||
|
|
||||||
using namespace Slic3r;
|
using namespace Slic3r;
|
||||||
using namespace Slic3r::GUI;
|
using namespace Slic3r::GUI;
|
||||||
|
|
||||||
|
@ -96,6 +98,11 @@ void CreateFontImageJob::process(Ctl &ctl)
|
||||||
r->encode(encoder);
|
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 &)
|
void CreateFontImageJob::finalize(bool canceled, std::exception_ptr &)
|
||||||
{
|
{
|
||||||
if (m_input.count_opened_font_files)
|
if (m_input.count_opened_font_files)
|
||||||
|
@ -118,4 +125,12 @@ void CreateFontImageJob::finalize(bool canceled, std::exception_ptr &)
|
||||||
// bind default texture
|
// bind default texture
|
||||||
GLuint no_texture_id = 0;
|
GLuint no_texture_id = 0;
|
||||||
glsafe(::glBindTexture(target, no_texture_id));
|
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();
|
||||||
}
|
}
|
|
@ -77,7 +77,7 @@ class PlaterWorker: public Worker {
|
||||||
<< std::fixed // do not use scientific notations
|
<< std::fixed // do not use scientific notations
|
||||||
<< "Job '" << typeid(*m_job).name() << "' "
|
<< "Job '" << typeid(*m_job).name() << "' "
|
||||||
<< "spend " << m_process_duration + finalize_duration << "ms "
|
<< "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 {
|
if (eptr) try {
|
||||||
std::rethrow_exception(eptr);
|
std::rethrow_exception(eptr);
|
||||||
|
|
Loading…
Reference in a new issue