Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Ideal GEF Viewer eats up CPU
Ideal GEF Viewer eats up CPU [message #486533] Fri, 18 September 2009 04:43 Go to next message
Vijay Raj
Messages: 608
Registered: July 2009
Senior Member
Hi,

I have a GEF viewer with large figure,
And an associated outline view for the same,

With outline view the application eats up cpu even while minimized,

Without outline view the application starts eating CPU once in focus with
no user activity,

Is this right,
How can i find out what is eating the CPU,
a break point position in GEF or draw2d classes would be appreciated...


---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
Re: Ideal GEF Viewer eats up CPU [message #486541 is a reply to message #486533] Fri, 18 September 2009 06:46 Go to previous messageGo to next message
Vijay Raj
Messages: 608
Registered: July 2009
Senior Member
vijay wrote:

> Hi,

> I have a GEF viewer with large figure,
> And an associated outline view for the same,

> With outline view the application eats up cpu even while minimized,

outline view thumbnail updater runs continuously, even when application is
minimized is this right???

> Without outline view the application starts eating CPU once in focus with
> no user activity,

I solved the above problem,This problem was because of
figure.setBackground calls in painFigure method,the setBackground should
be called on graphics instance not on figure instance.
(Hope this would help others)

> Is this right,
> How can i find out what is eating the CPU,
> a break point position in GEF or draw2d classes would be appreciated...


---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
icon4.gif  Re: Ideal GEF Viewer eats up CPU [message #486808 is a reply to message #486541] Sat, 19 September 2009 11:48 Go to previous message
Vijay Raj
Messages: 608
Registered: July 2009
Senior Member
Why does the ThubmnailUpdater of Thumbnail class update the image title by tile...

Is there a reason for this type of update...
In the run method..
public void run() {
		if (!isActive() || !isRunning())
			return;
		int v = getCurrentVTile();
		int sy1 = v * tileSize.height;
		int sy2 = Math.min((v + 1) * tileSize.height, getSourceRectangle().height);
		
		int h = getCurrentHTile();
		int sx1 = h * tileSize.width;
		int sx2 = Math.min((h + 1) * tileSize.width, getSourceRectangle().width);
		org.eclipse.draw2d.geometry.Point p = getSourceRectangle().getLocation();

		Rectangle rect = new Rectangle(sx1 + p.x, sy1 + p.y, sx2 - sx1, sy2 - sy1);
		thumbnailGraphics.pushState();
		thumbnailGraphics.setClip(rect);
		thumbnailGraphics.fillRectangle(rect);
		sourceFigure.paint(thumbnailGraphics);
		thumbnailGraphics.popState();
		
		if (getCurrentHTile() < (hTiles - 1))
			setCurrentHTile(getCurrentHTile() + 1);
		else {
			setCurrentHTile(0);
			if (getCurrentVTile() < (vTiles - 1))
				setCurrentVTile(getCurrentVTile() + 1);
			else
				setCurrentVTile(0);
		}
		
		if (getCurrentHTile() != 0 || getCurrentVTile() != 0)
			Display.getCurrent().asyncExec(this);
		else if (isDirty()) {
			setDirty(false);
			Display.getCurrent().asyncExec(this);
			repaint();
		} else {
			stop();
			repaint();
		}
	}


for every single tile update a async exec is called...



---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
Previous Topic:Drawing JFreeChart chart in Draw2D figure
Next Topic:GEF UML auto layout
Goto Forum:
  


Current Time: Sun Sep 21 12:04:27 GMT 2014

Powered by FUDForum. Page generated in 0.01601 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software