sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.util/src/com/nokia/carbide/cpp/pi/util/FunctionColorPalette.java
author Matti Laitinen <matti.t.laitinen@nokia.com>
Thu, 11 Feb 2010 15:32:31 +0200
changeset 2 b9ab3b238396
permissions -rw-r--r--
Initial version of Performance Investigator under EPL

/*
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of the License "Eclipse Public License v1.0"
 * which accompanies this distribution, and is available
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
 *
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
 *
 * Description: 
 *
 */

package com.nokia.carbide.cpp.pi.util;

import org.eclipse.swt.graphics.RGB;

public class FunctionColorPalette extends TableColorPalette {

	@Override
	public RGB getConstantRGB(Object entry) {
		assert (entry instanceof String);
		String func_name = ((String)entry).toLowerCase();
		
		// Gray out HAL Idle and RestoreIrqs that most of the empty cycle are spun
		if (func_name.startsWith("imphal::idle")) { //$NON-NLS-1$
	    	return new RGB(192,192,192); // AWT Color.lightGray
		}
		if (func_name.startsWith("imphal::restoreirqs")) { //$NON-NLS-1$
	    	return new RGB(192,192,192); // AWT Color.lightGray
		}
		
		// EKA2
		if (func_name.startsWith("nkern::restoreinterrupts") || //$NON-NLS-1$
				func_name.startsWith("a::nullthread") || //$NON-NLS-1$
				func_name.startsWith("kernelmain") || //$NON-NLS-1$
				func_name.contains("::cpuidle()") || //$NON-NLS-1$
				func_name.startsWith("nkern::disableallinterrupts()") || //$NON-NLS-1$
				func_name.startsWith("ntimerq::timeraddress")) { //$NON-NLS-1$
	    	return new RGB(192,192,192); // AWT Color.lightGray			
		}
		
		// default function not found
		if (func_name.startsWith("function not found_")) { //$NON-NLS-1$
			return new RGB(64, 64, 64);	// AWT Color.darkGray
		}
		
	    return null;
	}

}