[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/");
|
etk::theme::setNameDefault("COLOR", "color/black/");
|
||||||
// parse the debug level:
|
// parse the debug level:
|
||||||
for(int32_t iii = 0; iii < m_commandLine.size() ; ++iii) {
|
for(int32_t iii = 0; iii < m_commandLine.size() ; ++iii) {
|
||||||
if (m_commandLine.get(iii) == "-l0") {
|
if (m_commandLine.get(iii) == "--ewol-fps") {
|
||||||
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") {
|
|
||||||
m_displayFps=true;
|
m_displayFps=true;
|
||||||
} else if (m_commandLine.get(iii) == "--dbg-file") {
|
} else if ( m_commandLine.get(iii) == "-h"
|
||||||
// TODO : Set it back ...
|
|| m_commandLine.get(iii) == "--help") {
|
||||||
//etk::cout.setOutputFile(true);
|
// TODO ...
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -651,10 +634,13 @@ bool ewol::Context::OS_Draw(bool _displayEveryTime) {
|
|||||||
if (m_displayFps == true) {
|
if (m_displayFps == true) {
|
||||||
m_FpsSystem.toc();
|
m_FpsSystem.toc();
|
||||||
m_FpsFlush.tic();
|
m_FpsFlush.tic();
|
||||||
|
}
|
||||||
|
if (hasDisplayDone == true) {
|
||||||
|
if (m_displayFps == true) {
|
||||||
m_FpsFlush.incrementCounter();
|
m_FpsFlush.incrementCounter();
|
||||||
}
|
}
|
||||||
ewol::openGL::flush();
|
ewol::openGL::flush();
|
||||||
//glFinish();
|
}
|
||||||
if (m_displayFps == true) {
|
if (m_displayFps == true) {
|
||||||
m_FpsFlush.toc();
|
m_FpsFlush.toc();
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ namespace ewol {
|
|||||||
int64_t currentTime = ewol::getTime();
|
int64_t currentTime = ewol::getTime();
|
||||||
int64_t processTimeLocal = (currentTime - ticTime);
|
int64_t processTimeLocal = (currentTime - ticTime);
|
||||||
if (displayTime == true) {
|
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) {
|
if (drwingDone) {
|
||||||
min = std::min(min, processTimeLocal);
|
min = std::min(min, processTimeLocal);
|
||||||
@ -108,19 +108,19 @@ namespace ewol {
|
|||||||
void draw() {
|
void draw() {
|
||||||
if (true == display) {
|
if (true == display) {
|
||||||
if (nbDisplayTime>0) {
|
if (nbDisplayTime>0) {
|
||||||
EWOL_INFO(m_displayName << " : Active : "
|
EWOL_PRINT(m_displayName << " : Active : "
|
||||||
<< (float)((float)min / 1000.0) << "ms "
|
<< (float)((float)min / 1000.0) << "ms "
|
||||||
<< (float)((float)avg / (float)nbDisplayTime / 1000.0) << "ms "
|
<< (float)((float)avg / (float)nbDisplayTime / 1000.0) << "ms "
|
||||||
<< (float)((float)max / 1000.0) << "ms ");
|
<< (float)((float)max / 1000.0) << "ms ");
|
||||||
}
|
}
|
||||||
if (nbCallTime-nbDisplayTime>0) {
|
if (nbCallTime-nbDisplayTime>0) {
|
||||||
EWOL_INFO(m_displayName << " : idle : "
|
EWOL_PRINT(m_displayName << " : idle : "
|
||||||
<< (float)((float)min_idle / 1000.0) << "ms "
|
<< (float)((float)min_idle / 1000.0) << "ms "
|
||||||
<< (float)((float)avg_idle / (float)(nbCallTime-nbDisplayTime) / 1000.0) << "ms "
|
<< (float)((float)avg_idle / (float)(nbCallTime-nbDisplayTime) / 1000.0) << "ms "
|
||||||
<< (float)((float)max_idle / 1000.0) << "ms ");
|
<< (float)((float)max_idle / 1000.0) << "ms ");
|
||||||
}
|
}
|
||||||
if (true == m_displayFPS) {
|
if (true == m_displayFPS) {
|
||||||
EWOL_INFO("FPS : " << nbDisplayTime << "/" << nbCallTime << "fps");
|
EWOL_PRINT("FPS : " << nbDisplayTime << "/" << nbCallTime << "fps");
|
||||||
}
|
}
|
||||||
max = 0;
|
max = 0;
|
||||||
min = 99999999999999LL;
|
min = 99999999999999LL;
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int mm_main(int argc, const char *argv[]);
|
int mm_main(int _argc, const char *_argv[]);
|
||||||
void mm_exit();
|
void mm_exit();
|
||||||
void mm_openURL(const char *_url);
|
void mm_openURL(const char *_url);
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ class MacOSInterface : public ewol::Context {
|
|||||||
private:
|
private:
|
||||||
ewol::key::Special m_guiKeyBoardMode;
|
ewol::key::Special m_guiKeyBoardMode;
|
||||||
public:
|
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) {
|
ewol::Context(_application, _argc, _argv) {
|
||||||
mm_main(_argc, _argv);
|
mm_main(_argc, _argv);
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int mm_main(int argc, const char *argv[]);
|
int mm_main(int _argc, const char* _argv[]);
|
||||||
int mm_run();
|
int mm_run();
|
||||||
void mm_stopApplication();
|
void mm_stopApplication();
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
id window = nil;
|
id window = nil;
|
||||||
|
|
||||||
int mm_main(int argc, const char *argv[]) {
|
int mm_main(int _argc, const char* _argv[]) {
|
||||||
[NSAutoreleasePool new];
|
[NSAutoreleasePool new];
|
||||||
|
|
||||||
[NSApplication sharedApplication];
|
[NSApplication sharedApplication];
|
||||||
@ -40,10 +40,6 @@ int mm_main(int argc, const char *argv[]) {
|
|||||||
// create the label to qui the application :
|
// create the label to qui the application :
|
||||||
id quitTitle = [@"Quit " stringByAppendingString:appName];
|
id quitTitle = [@"Quit " stringByAppendingString:appName];
|
||||||
// create the item to quit the appllication with META+q at shortCut
|
// 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
|
id quitMenuItem = [ [ [NSMenuItem alloc] initWithTitle:quitTitle
|
||||||
action:@selector(stop:) keyEquivalent:@"q"] autorelease];
|
action:@selector(stop:) keyEquivalent:@"q"] autorelease];
|
||||||
|
|
||||||
@ -96,16 +92,15 @@ int mm_main(int argc, const char *argv[]) {
|
|||||||
|
|
||||||
int mm_run(void) {
|
int mm_run(void) {
|
||||||
[NSApp run];
|
[NSApp run];
|
||||||
EWOL_INFO("END of application");
|
EWOL_DEBUG("END of application");
|
||||||
// return no error
|
// return no error
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void mm_stopApplication() {
|
void mm_stopApplication() {
|
||||||
EWOL_INFO("NSApp terminate start.");
|
EWOL_DEBUG("NSApp terminate start.");
|
||||||
[window closeRequestEwol];
|
[window closeRequestEwol];
|
||||||
[NSApp stop:nil];
|
[NSApp stop:nil];
|
||||||
//[NSApp terminate:nil];
|
EWOL_DEBUG("NSApp terminate done");
|
||||||
EWOL_INFO("NSApp terminate done");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,11 +17,10 @@
|
|||||||
@implementation OpenGLView
|
@implementation OpenGLView
|
||||||
|
|
||||||
|
|
||||||
- (void) prepareOpenGL
|
- (void) prepareOpenGL {
|
||||||
{
|
EWOL_INFO("prepare");
|
||||||
EWOL_ERROR("prepare");
|
|
||||||
GLint swapInt = 1;
|
GLint swapInt = 1;
|
||||||
[[self openGLContext] setValues:&swapInt forParameter:NSOpenGLCPSwapInterval]; // set to vbl sync
|
[[self openGLContext] setValues:&swapInt forParameter:NSOpenGLCPSwapInterval];
|
||||||
// set system dpi size :
|
// set system dpi size :
|
||||||
NSScreen *screen = [NSScreen mainScreen];
|
NSScreen *screen = [NSScreen mainScreen];
|
||||||
NSDictionary *description = [screen deviceDescription];
|
NSDictionary *description = [screen deviceDescription];
|
||||||
@ -31,16 +30,16 @@
|
|||||||
ewol::Dimension::setPixelRatio(vec2((float)displayPixelSize.width/(float)displayPhysicalSize.width,
|
ewol::Dimension::setPixelRatio(vec2((float)displayPixelSize.width/(float)displayPhysicalSize.width,
|
||||||
(float)displayPixelSize.height/(float)displayPhysicalSize.height),
|
(float)displayPixelSize.height/(float)displayPhysicalSize.height),
|
||||||
ewol::Dimension::Millimeter);
|
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 {
|
-(void) drawRect: (NSRect) bounds {
|
||||||
if ( ! _refreshTimer ) {
|
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);
|
MacOs::draw(false);
|
||||||
glFlush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -48,48 +47,17 @@
|
|||||||
*/
|
*/
|
||||||
- (void) animationTimerFired: (NSTimer *) timer {
|
- (void) animationTimerFired: (NSTimer *) timer {
|
||||||
[self setNeedsDisplay:YES];
|
[self setNeedsDisplay:YES];
|
||||||
//EWOL_INFO("view refresh ..." );
|
EWOL_WARNING("view refresh ..." );
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)reshape {
|
-(void)reshape {
|
||||||
EWOL_INFO("view reshape (" << [self frame].size.width << "," << [self frame].size.height << ")" );
|
EWOL_INFO("view reshape (" << [self frame].size.width << "," << [self frame].size.height << ")" );
|
||||||
|
|
||||||
// window resize; width and height are in pixel coordinates
|
// window resize; width and height are in pixel coordinates
|
||||||
// but they are floats
|
// but they are floats
|
||||||
float width = [self frame].size.width;
|
float width = [self frame].size.width;
|
||||||
float height = [self frame].size.height;
|
float height = [self frame].size.height;
|
||||||
MacOs::resize(width,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
|
@end
|
||||||
|
|
||||||
|
@ -205,13 +205,15 @@ static ewol::key::Special guiKeyBoardMode;
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (([theEvent modifierFlags] & NSControlKeyMask) != 0) {
|
if (([theEvent modifierFlags] & NSControlKeyMask) != 0) {
|
||||||
EWOL_VERBOSE("NSControlKeyMask");
|
//EWOL_VERBOSE("NSControlKeyMask");
|
||||||
if (guiKeyBoardMode.getCtrl() == false) {
|
if (guiKeyBoardMode.getCtrl() == false) {
|
||||||
|
EWOL_VERBOSE("NSControlKeyMask DOWN");
|
||||||
guiKeyBoardMode.setCtrl(true);
|
guiKeyBoardMode.setCtrl(true);
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, ewol::key::keyboardCtrlLeft, true, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, ewol::key::keyboardCtrlLeft, true, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (guiKeyBoardMode.getCtrl() == true) {
|
if (guiKeyBoardMode.getCtrl() == true) {
|
||||||
|
EWOL_VERBOSE("NSControlKeyMask UP");
|
||||||
guiKeyBoardMode.setCtrl(false);
|
guiKeyBoardMode.setCtrl(false);
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, ewol::key::keyboardCtrlLeft, false, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, ewol::key::keyboardCtrlLeft, false, false);
|
||||||
}
|
}
|
||||||
@ -424,17 +426,14 @@ static ewol::key::Special guiKeyBoardMode;
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)closeRequestEwol {
|
- (void)closeRequestEwol {
|
||||||
EWOL_ERROR("closeRequestEwol: BEGIN");
|
EWOL_VERBOSE("closeRequestEwol: BEGIN");
|
||||||
[super close];
|
[super close];
|
||||||
EWOL_ERROR("closeRequestEwol: END");
|
EWOL_VERBOSE("closeRequestEwol: END");
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)close {
|
- (void)close {
|
||||||
EWOL_ERROR("close:");
|
EWOL_VERBOSE("close:");
|
||||||
MacOs::stopRequested();
|
MacOs::stopRequested();
|
||||||
// TODO: add check of close request ...
|
|
||||||
//[super close];
|
|
||||||
//[NSApp terminate:self];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -1294,8 +1294,7 @@ class X11Interface : public ewol::Context {
|
|||||||
}
|
}
|
||||||
/****************************************************************************************/
|
/****************************************************************************************/
|
||||||
void clipBoardSet(enum ewol::context::clipBoard::clipboardListe _clipboardID) {
|
void clipBoardSet(enum ewol::context::clipBoard::clipboardListe _clipboardID) {
|
||||||
switch (_clipboardID)
|
switch (_clipboardID) {
|
||||||
{
|
|
||||||
case ewol::context::clipBoard::clipboardSelection:
|
case ewol::context::clipBoard::clipboardSelection:
|
||||||
// Request the selection :
|
// Request the selection :
|
||||||
if (false == m_clipBoardOwnerPrimary) {
|
if (false == m_clipBoardOwnerPrimary) {
|
||||||
|
@ -16,6 +16,7 @@ namespace ewol {
|
|||||||
};
|
};
|
||||||
#define EWOL_BASE(info,data) TK_LOG_BASE(ewol::getLogId(),info,data)
|
#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_CRITICAL(data) EWOL_BASE(1, data)
|
||||||
#define EWOL_ERROR(data) EWOL_BASE(2, data)
|
#define EWOL_ERROR(data) EWOL_BASE(2, data)
|
||||||
#define EWOL_WARNING(data) EWOL_BASE(3, data)
|
#define EWOL_WARNING(data) EWOL_BASE(3, data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user