sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.util/src/com/nokia/carbide/cpp/pi/util/FunctionColorPalette.java
changeset 2 b9ab3b238396
equal deleted inserted replaced
1:1050670c6980 2:b9ab3b238396
       
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of the License "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description: 
       
    15  *
       
    16  */
       
    17 
       
    18 package com.nokia.carbide.cpp.pi.util;
       
    19 
       
    20 import org.eclipse.swt.graphics.RGB;
       
    21 
       
    22 public class FunctionColorPalette extends TableColorPalette {
       
    23 
       
    24 	@Override
       
    25 	public RGB getConstantRGB(Object entry) {
       
    26 		assert (entry instanceof String);
       
    27 		String func_name = ((String)entry).toLowerCase();
       
    28 		
       
    29 		// Gray out HAL Idle and RestoreIrqs that most of the empty cycle are spun
       
    30 		if (func_name.startsWith("imphal::idle")) { //$NON-NLS-1$
       
    31 	    	return new RGB(192,192,192); // AWT Color.lightGray
       
    32 		}
       
    33 		if (func_name.startsWith("imphal::restoreirqs")) { //$NON-NLS-1$
       
    34 	    	return new RGB(192,192,192); // AWT Color.lightGray
       
    35 		}
       
    36 		
       
    37 		// EKA2
       
    38 		if (func_name.startsWith("nkern::restoreinterrupts") || //$NON-NLS-1$
       
    39 				func_name.startsWith("a::nullthread") || //$NON-NLS-1$
       
    40 				func_name.startsWith("kernelmain") || //$NON-NLS-1$
       
    41 				func_name.contains("::cpuidle()") || //$NON-NLS-1$
       
    42 				func_name.startsWith("nkern::disableallinterrupts()") || //$NON-NLS-1$
       
    43 				func_name.startsWith("ntimerq::timeraddress")) { //$NON-NLS-1$
       
    44 	    	return new RGB(192,192,192); // AWT Color.lightGray			
       
    45 		}
       
    46 		
       
    47 		// default function not found
       
    48 		if (func_name.startsWith("function not found_")) { //$NON-NLS-1$
       
    49 			return new RGB(64, 64, 64);	// AWT Color.darkGray
       
    50 		}
       
    51 		
       
    52 	    return null;
       
    53 	}
       
    54 
       
    55 }