[DEV] poc perfo CPU MacOS
This commit is contained in:
parent
e83bae08cb
commit
049a853387
@ -325,28 +325,11 @@ ewol::Context::Context(ewol::context::Application* _application, int32_t _argc,
|
||||
etk::theme::setNameDefault("COLOR", "color/black/");
|
||||
// parse the debug level:
|
||||
for(int32_t iii = 0; iii < m_commandLine.size() ; ++iii) {
|
||||
if (m_commandLine.get(iii) == "-l0") {
|
||||
etk::log::setLevel(etk::log::logLevelNone);
|
||||
} else if (m_commandLine.get(iii) == "-l1") {
|
||||
etk::log::setLevel(etk::log::logLevelCritical);
|
||||
} else if (m_commandLine.get(iii) == "-l2") {
|
||||
etk::log::setLevel(etk::log::logLevelError);
|
||||
} else if (m_commandLine.get(iii) == "-l3") {
|
||||
etk::log::setLevel(etk::log::logLevelWarning);
|
||||
} else if (m_commandLine.get(iii) == "-l4") {
|
||||
etk::log::setLevel(etk::log::logLevelInfo);
|
||||
} else if (m_commandLine.get(iii) == "-l5") {
|
||||
etk::log::setLevel(etk::log::logLevelDebug);
|
||||
} else if( m_commandLine.get(iii) == "-l6"
|
||||
|| m_commandLine.get(iii) == "-l7"
|
||||
|| m_commandLine.get(iii) == "-l8"
|
||||
|| m_commandLine.get(iii) == "-l9") {
|
||||
etk::log::setLevel(etk::log::logLevelVerbose);
|
||||
} else if (m_commandLine.get(iii) == "-fps") {
|
||||
if (m_commandLine.get(iii) == "--ewol-fps") {
|
||||
m_displayFps=true;
|
||||
} else if (m_commandLine.get(iii) == "--dbg-file") {
|
||||
// TODO : Set it back ...
|
||||
//etk::cout.setOutputFile(true);
|
||||
} else if ( m_commandLine.get(iii) == "-h"
|
||||
|| m_commandLine.get(iii) == "--help") {
|
||||
// TODO ...
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
@ -651,10 +634,13 @@ bool ewol::Context::OS_Draw(bool _displayEveryTime) {
|
||||
if (m_displayFps == true) {
|
||||
m_FpsSystem.toc();
|
||||
m_FpsFlush.tic();
|
||||
m_FpsFlush.incrementCounter();
|
||||
}
|
||||
ewol::openGL::flush();
|
||||
//glFinish();
|
||||
if (hasDisplayDone == true) {
|
||||
if (m_displayFps == true) {
|
||||
m_FpsFlush.incrementCounter();
|
||||
}
|
||||
ewol::openGL::flush();
|
||||
}
|
||||
if (m_displayFps == true) {
|
||||
m_FpsFlush.toc();
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ namespace ewol {
|
||||
int64_t currentTime = ewol::getTime();
|
||||
int64_t processTimeLocal = (currentTime - ticTime);
|
||||
if (displayTime == true) {
|
||||
EWOL_INFO(m_displayName << " : processTime : " << (float)((float)processTimeLocal / 1000.0) << "ms ");
|
||||
EWOL_PRINT(m_displayName << " : processTime : " << (float)((float)processTimeLocal / 1000.0) << "ms ");
|
||||
}
|
||||
if (drwingDone) {
|
||||
min = std::min(min, processTimeLocal);
|
||||
@ -108,19 +108,19 @@ namespace ewol {
|
||||
void draw() {
|
||||
if (true == display) {
|
||||
if (nbDisplayTime>0) {
|
||||
EWOL_INFO(m_displayName << " : Active : "
|
||||
<< (float)((float)min / 1000.0) << "ms "
|
||||
<< (float)((float)avg / (float)nbDisplayTime / 1000.0) << "ms "
|
||||
<< (float)((float)max / 1000.0) << "ms ");
|
||||
EWOL_PRINT(m_displayName << " : Active : "
|
||||
<< (float)((float)min / 1000.0) << "ms "
|
||||
<< (float)((float)avg / (float)nbDisplayTime / 1000.0) << "ms "
|
||||
<< (float)((float)max / 1000.0) << "ms ");
|
||||
}
|
||||
if (nbCallTime-nbDisplayTime>0) {
|
||||
EWOL_INFO(m_displayName << " : idle : "
|
||||
<< (float)((float)min_idle / 1000.0) << "ms "
|
||||
<< (float)((float)avg_idle / (float)(nbCallTime-nbDisplayTime) / 1000.0) << "ms "
|
||||
<< (float)((float)max_idle / 1000.0) << "ms ");
|
||||
EWOL_PRINT(m_displayName << " : idle : "
|
||||
<< (float)((float)min_idle / 1000.0) << "ms "
|
||||
<< (float)((float)avg_idle / (float)(nbCallTime-nbDisplayTime) / 1000.0) << "ms "
|
||||
<< (float)((float)max_idle / 1000.0) << "ms ");
|
||||
}
|
||||
if (true == m_displayFPS) {
|
||||
EWOL_INFO("FPS : " << nbDisplayTime << "/" << nbCallTime << "fps");
|
||||
EWOL_PRINT("FPS : " << nbDisplayTime << "/" << nbCallTime << "fps");
|
||||
}
|
||||
max = 0;
|
||||
min = 99999999999999LL;
|
||||
|
@ -13,7 +13,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int mm_main(int argc, const char *argv[]);
|
||||
int mm_main(int _argc, const char *_argv[]);
|
||||
void mm_exit();
|
||||
void mm_openURL(const char *_url);
|
||||
|
||||
|
@ -56,7 +56,7 @@ class MacOSInterface : public ewol::Context {
|
||||
private:
|
||||
ewol::key::Special m_guiKeyBoardMode;
|
||||
public:
|
||||
MacOSInterface(ewol::context::Application* _application, int32_t _argc, const char* _argv[]) :
|
||||
MacOSInterface(ewol::context::Application* _application, int _argc, const char* _argv[]) :
|
||||
ewol::Context(_application, _argc, _argv) {
|
||||
mm_main(_argc, _argv);
|
||||
}
|
||||
@ -216,7 +216,7 @@ void MacOs::stopRequested() {
|
||||
* @param std IO
|
||||
* @return std IO
|
||||
*/
|
||||
int ewol::run(ewol::context::Application* _application, int _argc, const char *_argv[]) {
|
||||
int ewol::run(ewol::context::Application* _application, int _argc, const char* _argv[]) {
|
||||
etk::init(_argc, _argv);
|
||||
interface = new MacOSInterface(_application, _argc, _argv);
|
||||
if (nullptr == interface) {
|
||||
|
@ -13,7 +13,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int mm_main(int argc, const char *argv[]);
|
||||
int mm_main(int _argc, const char* _argv[]);
|
||||
int mm_run();
|
||||
void mm_stopApplication();
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
id window = nil;
|
||||
|
||||
int mm_main(int argc, const char *argv[]) {
|
||||
int mm_main(int _argc, const char* _argv[]) {
|
||||
[NSAutoreleasePool new];
|
||||
|
||||
[NSApplication sharedApplication];
|
||||
@ -40,10 +40,6 @@ int mm_main(int argc, const char *argv[]) {
|
||||
// create the label to qui the application :
|
||||
id quitTitle = [@"Quit " stringByAppendingString:appName];
|
||||
// create the item to quit the appllication with META+q at shortCut
|
||||
/*
|
||||
id quitMenuItem = [ [ [NSMenuItem alloc] initWithTitle:quitTitle
|
||||
action:@selector(terminate:) keyEquivalent:@"q"] autorelease];
|
||||
*/
|
||||
id quitMenuItem = [ [ [NSMenuItem alloc] initWithTitle:quitTitle
|
||||
action:@selector(stop:) keyEquivalent:@"q"] autorelease];
|
||||
|
||||
@ -54,7 +50,7 @@ int mm_main(int argc, const char *argv[]) {
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// -- basic windows creation :
|
||||
// ----------------------- ----------------------------------------
|
||||
// ---------------------------------------------------------------
|
||||
// create a windows of size 800/600
|
||||
window = [ [ [EwolMainWindows alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600)
|
||||
styleMask:(NSTitledWindowMask|NSMiniaturizableWindowMask|NSClosableWindowMask) backing:NSBackingStoreBuffered defer:NO]
|
||||
@ -96,16 +92,15 @@ int mm_main(int argc, const char *argv[]) {
|
||||
|
||||
int mm_run(void) {
|
||||
[NSApp run];
|
||||
EWOL_INFO("END of application");
|
||||
EWOL_DEBUG("END of application");
|
||||
// return no error
|
||||
return 0;
|
||||
}
|
||||
|
||||
void mm_stopApplication() {
|
||||
EWOL_INFO("NSApp terminate start.");
|
||||
EWOL_DEBUG("NSApp terminate start.");
|
||||
[window closeRequestEwol];
|
||||
[NSApp stop:nil];
|
||||
//[NSApp terminate:nil];
|
||||
EWOL_INFO("NSApp terminate done");
|
||||
EWOL_DEBUG("NSApp terminate done");
|
||||
}
|
||||
|
||||
|
@ -17,11 +17,10 @@
|
||||
@implementation OpenGLView
|
||||
|
||||
|
||||
- (void) prepareOpenGL
|
||||
{
|
||||
EWOL_ERROR("prepare");
|
||||
- (void) prepareOpenGL {
|
||||
EWOL_INFO("prepare");
|
||||
GLint swapInt = 1;
|
||||
[[self openGLContext] setValues:&swapInt forParameter:NSOpenGLCPSwapInterval]; // set to vbl sync
|
||||
[[self openGLContext] setValues:&swapInt forParameter:NSOpenGLCPSwapInterval];
|
||||
// set system dpi size :
|
||||
NSScreen *screen = [NSScreen mainScreen];
|
||||
NSDictionary *description = [screen deviceDescription];
|
||||
@ -31,65 +30,34 @@
|
||||
ewol::Dimension::setPixelRatio(vec2((float)displayPixelSize.width/(float)displayPhysicalSize.width,
|
||||
(float)displayPixelSize.height/(float)displayPhysicalSize.height),
|
||||
ewol::Dimension::Millimeter);
|
||||
_refreshTimer=[ [ NSTimer scheduledTimerWithTimeInterval:0.017 target:self selector:@selector(animationTimerFired:) userInfo:nil repeats:YES ] retain ] ;
|
||||
//_refreshTimer=[ [ NSTimer scheduledTimerWithTimeInterval:0.017 target:self selector:@selector(animationTimerFired:) userInfo:nil repeats:YES ] retain ] ;
|
||||
|
||||
}
|
||||
|
||||
-(void) drawRect: (NSRect) bounds {
|
||||
if ( ! _refreshTimer ) {
|
||||
_refreshTimer=[ [ NSTimer scheduledTimerWithTimeInterval:0.017 target:self selector:@selector(animationTimerFired:) userInfo:nil repeats:YES ] retain ] ;
|
||||
//_refreshTimer=[ [ NSTimer scheduledTimerWithTimeInterval:0.017 target:self selector:@selector(animationTimerFired:) userInfo:nil repeats:YES ] retain ] ;
|
||||
EWOL_WARNING("create timer ... ");
|
||||
}
|
||||
MacOs::draw(true);
|
||||
glFlush();
|
||||
MacOs::draw(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Service the animation timer.
|
||||
*/
|
||||
- (void) animationTimerFired: (NSTimer *) timer {
|
||||
[ self setNeedsDisplay: YES ];
|
||||
//EWOL_INFO("view refresh ..." );
|
||||
[self setNeedsDisplay:YES];
|
||||
EWOL_WARNING("view refresh ..." );
|
||||
}
|
||||
|
||||
-(void)reshape {
|
||||
EWOL_INFO("view reshape (" << [self frame].size.width << "," << [self frame].size.height << ")" );
|
||||
|
||||
// window resize; width and height are in pixel coordinates
|
||||
// but they are floats
|
||||
float width = [self frame].size.width;
|
||||
float height = [self frame].size.height;
|
||||
MacOs::resize(width,height);
|
||||
}
|
||||
#define FRAME_INTERVAL (0.01)
|
||||
|
||||
static NSTimer *timer = nil;
|
||||
|
||||
- (void)windowDidResignMain:(NSNotification *)notification {
|
||||
// NSLog(@"window did resign main");
|
||||
[timer invalidate];
|
||||
|
||||
//game_deactivate(); // freeze, pause
|
||||
}
|
||||
|
||||
- (void)windowDidBecomeMain:(NSNotification *)notification {
|
||||
// NSLog(@"window did become main");
|
||||
|
||||
//game_activate();
|
||||
/*
|
||||
timer = [NSTimer timerWithTimeInterval:FRAME_INTERVAL
|
||||
target:self
|
||||
selector:@selector(timerEvent:)
|
||||
userInfo:nil
|
||||
repeats:YES];
|
||||
|
||||
[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
|
||||
*/
|
||||
}
|
||||
|
||||
- (void)timerEvent:(NSTimer *)t {
|
||||
//run_game();
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
@ -205,13 +205,15 @@ static ewol::key::Special guiKeyBoardMode;
|
||||
}
|
||||
|
||||
if (([theEvent modifierFlags] & NSControlKeyMask) != 0) {
|
||||
EWOL_VERBOSE("NSControlKeyMask");
|
||||
//EWOL_VERBOSE("NSControlKeyMask");
|
||||
if (guiKeyBoardMode.getCtrl() == false) {
|
||||
EWOL_VERBOSE("NSControlKeyMask DOWN");
|
||||
guiKeyBoardMode.setCtrl(true);
|
||||
MacOs::setKeyboardMove(guiKeyBoardMode, ewol::key::keyboardCtrlLeft, true, false);
|
||||
}
|
||||
} else {
|
||||
if (guiKeyBoardMode.getCtrl() == true) {
|
||||
EWOL_VERBOSE("NSControlKeyMask UP");
|
||||
guiKeyBoardMode.setCtrl(false);
|
||||
MacOs::setKeyboardMove(guiKeyBoardMode, ewol::key::keyboardCtrlLeft, false, false);
|
||||
}
|
||||
@ -424,17 +426,14 @@ static ewol::key::Special guiKeyBoardMode;
|
||||
}
|
||||
|
||||
- (void)closeRequestEwol {
|
||||
EWOL_ERROR("closeRequestEwol: BEGIN");
|
||||
EWOL_VERBOSE("closeRequestEwol: BEGIN");
|
||||
[super close];
|
||||
EWOL_ERROR("closeRequestEwol: END");
|
||||
EWOL_VERBOSE("closeRequestEwol: END");
|
||||
}
|
||||
|
||||
- (void)close {
|
||||
EWOL_ERROR("close:");
|
||||
EWOL_VERBOSE("close:");
|
||||
MacOs::stopRequested();
|
||||
// TODO: add check of close request ...
|
||||
//[super close];
|
||||
//[NSApp terminate:self];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -1294,8 +1294,7 @@ class X11Interface : public ewol::Context {
|
||||
}
|
||||
/****************************************************************************************/
|
||||
void clipBoardSet(enum ewol::context::clipBoard::clipboardListe _clipboardID) {
|
||||
switch (_clipboardID)
|
||||
{
|
||||
switch (_clipboardID) {
|
||||
case ewol::context::clipBoard::clipboardSelection:
|
||||
// Request the selection :
|
||||
if (false == m_clipBoardOwnerPrimary) {
|
||||
|
@ -16,6 +16,7 @@ namespace ewol {
|
||||
};
|
||||
#define EWOL_BASE(info,data) TK_LOG_BASE(ewol::getLogId(),info,data)
|
||||
|
||||
#define EWOL_PRINT(data) EWOL_BASE(-1, data)
|
||||
#define EWOL_CRITICAL(data) EWOL_BASE(1, data)
|
||||
#define EWOL_ERROR(data) EWOL_BASE(2, data)
|
||||
#define EWOL_WARNING(data) EWOL_BASE(3, data)
|
||||
|
Loading…
x
Reference in New Issue
Block a user