Reduce the number of getParent() function calls for print operations
This commit is contained in:
parent
70f5b545a5
commit
62890f6ecc
|
@ -1,3 +1,6 @@
|
||||||
|
2015-10-13 Markus Gans <guru.mail@muenster.de>
|
||||||
|
* Reduce the number of getParent() function calls for print operations
|
||||||
|
|
||||||
2015-10-11 Markus Gans <guru.mail@muenster.de>
|
2015-10-11 Markus Gans <guru.mail@muenster.de>
|
||||||
* Improve attribute setting for bold, reverse and underline output
|
* Improve attribute setting for bold, reverse and underline output
|
||||||
* Better support for monochrom terminals
|
* Better support for monochrom terminals
|
||||||
|
|
26
build.sh
26
build.sh
|
@ -4,25 +4,39 @@
|
||||||
PREFIX="/usr"
|
PREFIX="/usr"
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
"--help"|"help")
|
|
||||||
echo "Usage: $0 {help|debug|fulldebug|profile|gcov|release}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
"--debug"|"debug")
|
"--debug"|"debug")
|
||||||
./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -pedantic"
|
./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -pedantic"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--fulldebug"|"fulldebug")
|
"--fulldebug"|"fulldebug")
|
||||||
./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -Weffc++ -pedantic -pedantic-errors -Wextra -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimport -Winit-self -Winvalid-pch -Wlong-long -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wpadded -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstack-protector -Wstrict-aliasing -Wstrict-aliasing=2 -Wswitch -Wswitch-enum -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunreachable-code -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wsign-promo -Woverloaded-virtual -Wstrict-null-sentinel -fext-numeric-literals -Wreorder -Wnoexcept -Wnarrowing -Wliteral-suffix -Wctor-dtor-privacy"
|
./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -O0 -DDEBUG -W -Wall -Weffc++ -pedantic -pedantic-errors -Wextra -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimport -Winit-self -Winvalid-pch -Wlong-long -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wpadded -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstack-protector -Wstrict-aliasing -Wstrict-aliasing=2 -Wswitch -Wswitch-enum -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunreachable-code -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wsign-promo -Woverloaded-virtual -Wstrict-null-sentinel -fext-numeric-literals -Wreorder -Wnoexcept -Wnarrowing -Wliteral-suffix -Wctor-dtor-privacy"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--profile"|"profile")
|
"--profile"|"profile")
|
||||||
./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-pg -O0 -DDEBUG -W -Wall -pedantic"
|
./configure --prefix="$PREFIX" CPPFLAGS="-DDEBUG" CXXFLAGS="-g -pg -O0 -DDEBUG -W -Wall -pedantic"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"--gcov"|"gcov")
|
"--gcov"|"gcov")
|
||||||
./configure --prefix="$PREFIX" CXXFLAGS="-fprofile-arcs -ftest-coverage"
|
./configure --prefix="$PREFIX" CXXFLAGS="-fprofile-arcs -ftest-coverage"
|
||||||
;;
|
;;
|
||||||
"--release"|"release"|*)
|
|
||||||
|
"--release"|"release")
|
||||||
./configure --prefix="$PREFIX"
|
./configure --prefix="$PREFIX"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
"--help"|"help"|*)
|
||||||
|
echo "Usage:"
|
||||||
|
echo " $(basename "$0") {COMMAND}"
|
||||||
|
echo ""
|
||||||
|
echo "Commands:"
|
||||||
|
echo " help Show this help"
|
||||||
|
echo " debug Compile with debug option"
|
||||||
|
echo " fulldebug Compile with all warning options"
|
||||||
|
echo " profile Compile with profile option (analysis with gprof)"
|
||||||
|
echo " gcov Compile with options for coverage analysis with gcov"
|
||||||
|
echo " release Compile for release"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
make V=1 -j10
|
make V=1 -j10
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
LD_PRELOAD="/usr/lib64/libprofiler.so.0" CPUPROFILE=../text/ui.prof ../test/ui
|
LD_LIBRARY_PATH=../src/.libs/ LD_PRELOAD="/usr/lib64/libprofiler.so.0" CPUPROFILE=../test/.libs/ui.prof ../test/.libs/ui
|
||||||
pprof --gv ../test/ui ../test/ui.prof
|
pprof --gv ../test/.libs/ui ../test/.libs/ui.prof
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
LD_LIBRARY_PATH=../src/.libs/ valgrind --tool=callgrind -v ../test/.libs/ui 2>/dev/null
|
||||||
|
kcachegrind
|
||||||
|
rm -f callgrind.out.*
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
PROG="ui"
|
PROG="ui"
|
||||||
|
|
||||||
ltrace -o ./$PROG.ltrace ../test/.libs/$PROG
|
LD_LIBRARY_PATH=../src/.libs/ ltrace -o ./$PROG.ltrace ../test/.libs/$PROG
|
||||||
less ./$PROG.ltrace
|
less ./$PROG.ltrace
|
||||||
rm -f ./$PROG.ltrace
|
rm -f ./$PROG.ltrace ./gmon.out
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
DIR="$PWD"
|
DIR="$PWD"
|
||||||
cd ../src
|
cd ../test/.libs/
|
||||||
make clean
|
LD_LIBRARY_PATH=../../src/.libs/ ./ui
|
||||||
make profile
|
gprof ./ui >./profile.txt
|
||||||
./finalcut
|
|
||||||
gprof ./finalcut >./profile.txt
|
|
||||||
rm ./gmon.out
|
rm ./gmon.out
|
||||||
less ./profile.txt
|
less ./profile.txt
|
||||||
rm ./profile.txt
|
rm ./profile.txt
|
||||||
cd "$DIR"
|
cd "$DIR"
|
||||||
|
|
||||||
|
|
|
@ -3804,14 +3804,12 @@ int FTerm::print (FString& s)
|
||||||
term_area* area;
|
term_area* area;
|
||||||
FWidget* w;
|
FWidget* w;
|
||||||
w = static_cast<FWidget*>(this);
|
w = static_cast<FWidget*>(this);
|
||||||
FWidget* area_widget = FWindow::getWindowWidget(w);
|
area = w->getPrintArea();
|
||||||
|
|
||||||
if ( area_widget && area_widget->getVWin() )
|
if ( ! area )
|
||||||
area = area_widget->getVWin();
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
FWidget* area_widget = w->getRootWidget();
|
||||||
area = vdesktop;
|
area = vdesktop;
|
||||||
area_widget = w->getRootWidget();
|
|
||||||
if ( ! area_widget )
|
if ( ! area_widget )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -3934,14 +3932,12 @@ int FTerm::print (register int c)
|
||||||
term_area* area;
|
term_area* area;
|
||||||
FWidget* w;
|
FWidget* w;
|
||||||
w = static_cast<FWidget*>(this);
|
w = static_cast<FWidget*>(this);
|
||||||
FWidget* area_widget = FWindow::getWindowWidget(w);
|
area = w->getPrintArea();
|
||||||
|
|
||||||
if ( area_widget )
|
if ( ! area )
|
||||||
area = area_widget->getVWin();
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
FWidget* area_widget = w->getRootWidget();
|
||||||
area = vdesktop;
|
area = vdesktop;
|
||||||
area_widget = w->getRootWidget();
|
|
||||||
if ( ! area_widget )
|
if ( ! area_widget )
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@ FWidget::FWidget (FWidget* parent)
|
||||||
, adjustWidgetSize(1,1,1,1)
|
, adjustWidgetSize(1,1,1,1)
|
||||||
, adjustWidgetSizeGlobal(1,1,1,1)
|
, adjustWidgetSizeGlobal(1,1,1,1)
|
||||||
, statusbar_message()
|
, statusbar_message()
|
||||||
|
, print_area(0)
|
||||||
{
|
{
|
||||||
resize_term = false;
|
resize_term = false;
|
||||||
|
|
||||||
|
@ -359,6 +360,38 @@ void FWidget::setColorTheme()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
FTerm::term_area* FWidget::getPrintArea()
|
||||||
|
{
|
||||||
|
if ( print_area )
|
||||||
|
return print_area;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FWidget* area_widget = FWindow::getWindowWidget(this);
|
||||||
|
|
||||||
|
if ( area_widget )
|
||||||
|
{
|
||||||
|
term_area* area = area_widget->getVWin();
|
||||||
|
|
||||||
|
if ( area )
|
||||||
|
{
|
||||||
|
print_area = area;
|
||||||
|
return area;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void FWidget::setPrintArea(term_area* area)
|
||||||
|
{
|
||||||
|
print_area = area;
|
||||||
|
}
|
||||||
|
|
||||||
// protected methods of FWidget
|
// protected methods of FWidget
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
void FWidget::adjustSize()
|
void FWidget::adjustSize()
|
||||||
|
|
|
@ -277,6 +277,8 @@ class FWidget : public FObject, public FTerm
|
||||||
static FMenuBar* menubar;
|
static FMenuBar* menubar;
|
||||||
static FWidget* show_root_widget;
|
static FWidget* show_root_widget;
|
||||||
static FWidget* redraw_root_widget;
|
static FWidget* redraw_root_widget;
|
||||||
|
term_area* print_area;
|
||||||
|
friend class FTerm;
|
||||||
friend class FApplication;
|
friend class FApplication;
|
||||||
friend class FToggleButton;
|
friend class FToggleButton;
|
||||||
|
|
||||||
|
@ -288,6 +290,8 @@ class FWidget : public FObject, public FTerm
|
||||||
void processDestroy();
|
void processDestroy();
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
static void setColorTheme();
|
static void setColorTheme();
|
||||||
|
term_area* getPrintArea();
|
||||||
|
void setPrintArea(term_area*);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void adjustSize();
|
virtual void adjustSize();
|
||||||
|
|
Loading…
Reference in New Issue