Hi Raziye,

I have written simple Java parser for converting mcpat log into ptrace
file. Its is in still initial stage and mapping of data from log to to
corresponding element of hotspot floor plan is not accurate. This parser
works for developed considering *Alpha* target and some small changes
required to work with ARM or any other McPat log.

I have attached the parser, sample log file and ptrace output and let me
know any modifications are required?

Please share if you have ARM A9 floor plan if you have

Thanks,
Bala


On Sun, May 15, 2016 at 3:09 PM, raziye deylamsalehi <
[email protected]> wrote:

> Hello Bala
> which parser did you use for converting mcpat output to hotspot input as
> ptrace file?
> Please share it with me.
> Thanks,
> Raziye
>
> On Thu, May 12, 2016 at 8:51 AM, Balasaheb Dabhade <[email protected]
> > wrote:
>
>> Hi All,
>>
>> Sorry this question is not directly related to gem5.
>>
>> I am using gem5 for arm target and wanted to do thermal simulation for
>> benchmark program using HOTSPOT. Thermal simulation requires floor plan of
>> ARM processor. I tried to search it over internet but didn't get it.
>>
>> If anyone has ARM A9 processor floor plan in HotSpot format please share
>> with me.
>>
>> Thanks in advance  !!
>>
>> Thanks,
>> Bala
>>
>> _______________________________________________
>> gem5-users mailing list
>> [email protected]
>> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>>
>
>
> _______________________________________________
> gem5-users mailing list
> [email protected]
> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>

Attachment: input.ptrace
Description: Binary data

McPAT (version 1.3 of Feb, 2015) is computing the target processor...
 
Warning: icache array structure cannot satisfy throughput constraint.
Warning: icache array structure cannot satisfy latency constraint.
Warning: Branch Target Buffer array structure cannot satisfy throughput constraint.
Warning: Branch Target Buffer array structure cannot satisfy latency constraint.
Warning: Global Predictor array structure cannot satisfy throughput constraint.
Warning: Global Predictor array structure cannot satisfy latency constraint.
Warning: Predictor Chooser array structure cannot satisfy throughput constraint.
Warning: Predictor Chooser array structure cannot satisfy latency constraint.
Warning: dcache array structure cannot satisfy throughput constraint.
Warning: dcache array structure cannot satisfy latency constraint.

McPAT (version 1.3 of Feb, 2015) results  (current print level is 5)
*****************************************************************************************
  Technology 180 nm
  Interconnect metal projection= aggressive interconnect technology projection
  Core clock Rate(MHz) 1200

*****************************************************************************************
Processor: 
  Area = 303.259 mm^2
  Peak Power = 84.4501 W
  Total Leakage = 0.142034 W
  Peak Dynamic = 84.308 W
  Subthreshold Leakage = 0.138189 W
  Gate Leakage = 0.00384475 W
  Runtime Dynamic = -nan W

  Total Cores: 1 cores 
  Device Type= ITRS high performance device type
    Area = 119.289 mm^2
    Peak Dynamic = 50.146 W
    Subthreshold Leakage = 0.0542887 W
    Gate Leakage = 0.00334425 W
    Runtime Dynamic = 39.9531 W

  Total L2s: 
  Device Type= ITRS high performance device type
    Area = 135.613 mm^2
    Peak Dynamic = 4.76002 W
    Subthreshold Leakage = 0.0784831 W
    Gate Leakage = 0.000175445 W
    Runtime Dynamic = 0 W

  Total Second Level Directory: 
  Device Type= ITRS high performance device type
    Area = 1.67179 mm^2
    Peak Dynamic = 0.826596 W
    Subthreshold Leakage = 0.000382801 W
    Gate Leakage = 3.06958e-05 W
    Runtime Dynamic = 0 W

  Total NoCs (Network/Bus): 
  Device Type= ITRS high performance device type
    Area = 28.9285 mm^2
    Peak Dynamic = 14.8319 W
    Subthreshold Leakage = 0.00279147 W
    Gate Leakage = 0.000158098 W
    Runtime Dynamic = 0 W

  Total MCs: 2 Memory Controllers 
  Device Type= ITRS high performance device type
    Area = 17.7563 mm^2
    Peak Dynamic = 13.7436 W
    Subthreshold Leakage = 0.00224319 W
    Gate Leakage = 0.000136259 W
    Runtime Dynamic = -nan W

*****************************************************************************************
Core:
      Area = 119.289 mm^2
      Peak Dynamic = 50.146 W
      Subthreshold Leakage = 0.0542887 W
      Gate Leakage = 0.00334425 W
      Runtime Dynamic = 39.9531 W

      Instruction Fetch Unit:
        Area = 27.1851 mm^2
        Peak Dynamic = 8.65028 W
        Subthreshold Leakage = 0.00633777 W
        Gate Leakage = 0.000346142 W
        Runtime Dynamic = 4.75785 W

          Instruction Cache:
            Area = 11.4744 mm^2
            Peak Dynamic = 1.29115 W
            Subthreshold Leakage = 0.00391764 W
            Gate Leakage = 0.000183553 W
            Runtime Dynamic = 1.22194 W

          Branch Target Buffer:
            Area = 13.1967 mm^2
            Peak Dynamic = 0.548968 W
            Subthreshold Leakage = 0.00150571 W
            Gate Leakage = 9.06003e-05 W
            Runtime Dynamic = 1.41228 W

          Branch Predictor:
            Area = 1.75712 mm^2
            Peak Dynamic = 0.239897 W
            Subthreshold Leakage = 0.000500353 W
            Gate Leakage = 1.95603e-05 W
            Runtime Dynamic = 0.147638 W

              Global Predictor:
                Area = 0.607456 mm^2
                Peak Dynamic = 0.0825791 W
                Subthreshold Leakage = 0.000184661 W
                Gate Leakage = 7.36458e-06 W
                Runtime Dynamic = 0.0570608 W

              Local Predictor:
              L1_Local Predictor:
                Area = 0.282223 mm^2
                Peak Dynamic = 0.0303388 W
                Subthreshold Leakage = 7.96913e-05 W
                Gate Leakage = 2.92127e-06 W
                Runtime Dynamic = 0.0221345 W

              L2_Local Predictor:
                Area = 0.177264 mm^2
                Peak Dynamic = 0.0154884 W
                Subthreshold Leakage = 4.01694e-05 W
                Gate Leakage = 1.47445e-06 W
                Runtime Dynamic = 0.0112929 W

              Chooser:
                Area = 0.607456 mm^2
                Peak Dynamic = 0.0825791 W
                Subthreshold Leakage = 0.000184661 W
                Gate Leakage = 7.36458e-06 W
                Runtime Dynamic = 0.0570608 W

              RAS:
                Area = 0.0827205 mm^2
                Peak Dynamic = 0.0289113 W
                Subthreshold Leakage = 1.11699e-05 W
                Gate Leakage = 4.35453e-07 W
                Runtime Dynamic = 8.86239e-05 W

          Instruction Buffer:
            Area = 0.198955 mm^2
            Peak Dynamic = 1.8463 W
            Subthreshold Leakage = 3.21125e-05 W
            Gate Leakage = 1.24349e-06 W
            Runtime Dynamic = 0.307648 W

          Instruction Decoder:
            Area = 0.146031 mm^2
            Peak Dynamic = 4.07384 W
            Subthreshold Leakage = 7.07416e-05 W
            Gate Leakage = 3.32268e-06 W
            Runtime Dynamic = 1.01823 W

      Renaming Unit:
        Area = 3.08697 mm^2
        Peak Dynamic = 8.37018 W
        Subthreshold Leakage = 0.000501562 W
        Gate Leakage = 5.92044e-05 W
        Runtime Dynamic = 5.15016 W

          Int Front End RAT with 8 internal checkpoints:
            Area = 1.53495 mm^2
            Peak Dynamic = 4.72424 W
            Subthreshold Leakage = 0.00011933 W
            Gate Leakage = 7.05732e-06 W
            Runtime Dynamic = 3.0167 W

          FP Front End RAT with 8 internal checkpoints:
            Area = 0.504792 mm^2
            Peak Dynamic = 2.16672 W
            Subthreshold Leakage = 5.19429e-05 W
            Gate Leakage = 3.17329e-06 W
            Runtime Dynamic = 0.689905 W

          Free List:
            Area = 0.439651 mm^2
            Peak Dynamic = 0.101065 W
            Subthreshold Leakage = 1.12468e-05 W
            Gate Leakage = 6.40491e-07 W
            Runtime Dynamic = 0.12026 W

          FP Free List:
            Area = 0.195722 mm^2
            Peak Dynamic = 0.0779159 W
            Subthreshold Leakage = 7.82681e-06 W
            Gate Leakage = 4.71127e-07 W
            Runtime Dynamic = 0.023059 W

      Load Store Unit:
        Area = 48.635 mm^2
        Peak Dynamic = 8.69546 W
        Subthreshold Leakage = 0.00718051 W
        Gate Leakage = 0.000427145 W
        Runtime Dynamic = 19.183 W

          Data Cache:
            Area = 38.3148 mm^2
            Peak Dynamic = 6.18063 W
            Subthreshold Leakage = 0.00624994 W
            Gate Leakage = 0.000342058 W
            Runtime Dynamic = 16.7001 W

          LoadQ:
            Area = 2.76221 mm^2
            Peak Dynamic = 0.932355 W
            Subthreshold Leakage = 0.000309677 W
            Gate Leakage = 1.86125e-05 W
            Runtime Dynamic = 0.610914 W

          StoreQ:
            Area = 2.76221 mm^2
            Peak Dynamic = 0.932355 W
            Subthreshold Leakage = 0.000309677 W
            Gate Leakage = 1.86125e-05 W
            Runtime Dynamic = 1.22183 W

      Memory Management Unit:
        Area = 2.56797 mm^2
        Peak Dynamic = 1.31602 W
        Subthreshold Leakage = 0.000604377 W
        Runtime Dynamic = 1.47035 W

          Itlb:
            Area = 0.502823 mm^2
            Peak Dynamic = 0.0981371 W
            Subthreshold Leakage = 9.3038e-05 W
            Gate Leakage = 5.39814e-06 W
            Runtime Dynamic = 0.252471 W

          Dtlb:
            Area = 1.6533 mm^2
            Peak Dynamic = 0.242705 W
            Subthreshold Leakage = 0.000200123 W
            Gate Leakage = 1.17105e-05 W
            Runtime Dynamic = 0.242705 W

      Execution Unit:
        Area = 29.2899 mm^2
        Peak Dynamic = 23.114 W
        Subthreshold Leakage = 0.0199683 W
        Runtime Dynamic = 9.39181 W

          Register Files:
            Area = 9.92473 mm^2
            Peak Dynamic = 3.89176 W
            Subthreshold Leakage = 0.000278344 W
            Gate Leakage = 1.26653e-05 W
            Runtime Dynamic = 0.334178 W

              Integer RF:
                Area = 6.75967 mm^2
                Peak Dynamic = 2.2861 W
                Subthreshold Leakage = 0.000172855 W
                Gate Leakage = 7.93675e-06 W
                Runtime Dynamic = 0.334132 W

              Floating Point RF:
                Area = 3.16506 mm^2
                Peak Dynamic = 1.60566 W
                Subthreshold Leakage = 0.000105489 W
                Gate Leakage = 4.72854e-06 W
                Runtime Dynamic = 4.74667e-05 W

          Instruction Scheduler:
            Area = 5.25992 mm^2
            Peak Dynamic = 3.23778 W
            Subthreshold Leakage = 0.000280877 W
            Gate Leakage = 1.5515e-05 W
            Runtime Dynamic = 2.37355 W

              Instruction Window:
                Area = 1.27449 mm^2
                Peak Dynamic = 1.1685 W
                Subthreshold Leakage = 9.74811e-05 W
                Gate Leakage = 6.3522e-06 W
                Runtime Dynamic = 0.944331 W

              FP Instruction Window:
                Area = 0.510329 mm^2
                Peak Dynamic = 0.68792 W
                Subthreshold Leakage = 6.32652e-05 W
                Gate Leakage = 4.28314e-06 W
                Runtime Dynamic = 0.540787 W

              ROB:
                Area = 3.47511 mm^2
                Peak Dynamic = 1.38136 W
                Subthreshold Leakage = 0.000120131 W
                Gate Leakage = 4.87965e-06 W
                Runtime Dynamic = 0.888428 W

          Integer ALUs (Count: 4 ):
            Area = 0.8736 mm^2
            Peak Dynamic = 4.23312 W
            Subthreshold Leakage = 0.00403726 W
            Gate Leakage = 0.000246721 W
            Runtime Dynamic = 1.17179 W

          Floating Point Units (FPUs) (Count: 1 ):
            Area = 12.705 mm^2
            Peak Dynamic = 3.52215 W
            Subthreshold Leakage = 0.0146787 W
            Gate Leakage = 0.000897034 W
            Runtime Dynamic = 0.464062 W

          Results Broadcast Bus:
            Area Overhead = 0.114821 mm^2
            Peak Dynamic = 6.929 W
            Subthreshold Leakage = 0.000381852 W
            Gate Leakage = 2.33354e-05 W
            Runtime Dynamic = 3.748 W

*****************************************************************************************
L2
      Area = 135.613 mm^2
      Peak Dynamic = 4.76002 W
      Subthreshold Leakage = 0.0784831 W
      Gate Leakage = 0.000175445 W
      Runtime Dynamic = 0 W

*****************************************************************************************
Second Level Directory
      Area = 1.67179 mm^2
      Peak Dynamic = 0.826596 W
      Subthreshold Leakage = 0.000382801 W
      Gate Leakage = 3.06958e-05 W
      Runtime Dynamic = 0 W

*****************************************************************************************
Memory Controller:
      Area = 8.87813 mm^2
      Peak Dynamic = 6.8718 W
      Subthreshold Leakage = 0.00112159 W
      Gate Leakage = 6.81295e-05 W
      Runtime Dynamic = -nan W

      Front End Engine:
        Area = 5.24545 mm^2
        Peak Dynamic = 3.02969 W
        Subthreshold Leakage = 0.000282187 W
        Gate Leakage = 1.68325e-05 W
        Runtime Dynamic = -nan W

      Transaction Engine:
        Area = 1.50616 mm^2
        Peak Dynamic = 3.55926 W
        Subthreshold Leakage = 0.000348029 W
        Gate Leakage = 2.12684e-05 W
        Runtime Dynamic = -nan W

      PHY:
        Area = 2.12653 mm^2
        Peak Dynamic = 0.282843 W
        Subthreshold Leakage = 0.000491377 W
        Gate Leakage = 3.00286e-05 W
        Runtime Dynamic = -nan W

*****************************************************************************************
NOC
      Area = 28.9285 mm^2
      Peak Dynamic = 14.8319 W
      Subthreshold Leakage = 0.00279147 W
      Gate Leakage = 0.000158098 W
      Runtime Dynamic = 0 W

      Router: 
        Area = 28.2648 mm^2
        Peak Dynamic = 7.32833 W
        Subthreshold Leakage = 0.00189552 W
        Gate Leakage = 0.000103346 W
        Runtime Dynamic = 0 W

            Virtual Channel Buffer:
              Area = 16.9497 mm^2
              Peak Dynamic = 5.86693 W
              Subthreshold Leakage = 0.00109244 W
              Gate Leakage = 3.51874e-05 W
              Runtime Dynamic = 0 W

            Crossbar:
              Area = 0.357655 mm^2
              Peak Dynamic = 1.27997 W
              Subthreshold Leakage = 0.000801415 W
              Gate Leakage = 6.80527e-05 W
              Runtime Dynamic = 0 W

            Arbiter:
              Peak Dynamic = 0.181431 W
              Subthreshold Leakage = 1.65956e-06 W
              Gate Leakage = 1.05559e-07 W
              Runtime Dynamic = 0 W

      Per Router Links: 
        Area = 0.663789 mm^2
        Peak Dynamic = 7.50352 W
        Subthreshold Leakage = 0.000895947 W
        Gate Leakage = 5.47523e-05 W
        Runtime Dynamic = 0 W

*****************************************************************************************
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * @author Balasaheb Dabhade Parser to convert McPat output file logs into
 *         HotPot ptrace file
 */
public class MacPatParser {

	private static final Logger LOGGER = Logger.getLogger(MacPatParser.class.getName());

	public static void main(String[] args) throws Exception {
		
		LOGGER.log(Level.INFO, "PARSER STATED");

		if (args.length == 0) {
			LOGGER.log(Level.INFO, "PARSER STOP no log file specified");
			LOGGER.log(Level.INFO, "USAGE : java MacPatParser mcpat.log");
			System.exit(0);
		}

		String str = readAllLines(args[0]);
		ArrayList<String> l2 = getStats("L2", str);
		ArrayList<String> icache = getStats("Instruction Cache:", str);
		ArrayList<String> dcache = getStats("Data Cache:", str);
		ArrayList<String> bp = getStats("Branch Predictor:", str);
		ArrayList<String> dtb = getStats("Branch Target Buffer:", str);
		ArrayList<String> fadd = getStats("Floating Point Units (FPUs) (Count: 1 ):", str);
		ArrayList<String> frf = getStats("Floating Point RF:", str);
		ArrayList<String> fmul = getStats("Floating Point Units (FPUs) (Count: 1 ):", str);
		ArrayList<String> fpmap = getStats("Int Front End RAT with 8 internal checkpoints:", str);
		ArrayList<String> intmap = getStats("FP Front End RAT with 8 internal checkpoints:", str);
		ArrayList<String> intq = getStats("Int Front End RAT with 8 internal checkpoints:", str);
		ArrayList<String> irf = getStats("Integer RF:", str);
		ArrayList<String> intexe = getStats("Floating Point Units (FPUs) (Count: 1 ):", str);
		ArrayList<String> fpq = getStats("FP Front End RAT with 8 internal checkpoints:", str);
		ArrayList<String> lsu = getStats("Load Store Unit:", str);
		ArrayList<String> itb = getStats("Itlb:", str);
		ArrayList<ArrayList<String>> ptrace = new ArrayList<ArrayList<String>>();

		ptrace.add(l2);
		ptrace.add(l2);
		ptrace.add(l2);
		ptrace.add(icache);
		ptrace.add(dcache);
		ptrace.add(bp);
		ptrace.add(dtb);
		ptrace.add(fadd);
		ptrace.add(frf);
		ptrace.add(fmul);
		ptrace.add(fpmap);
		ptrace.add(intmap);
		ptrace.add(intq);
		ptrace.add(irf);
		ptrace.add(intexe);
		ptrace.add(fpq);
		ptrace.add(lsu);
		ptrace.add(itb);
		preparePtraceFile(ptrace);
		LOGGER.log(Level.INFO, "PARSER COMPLETED THE TASK");
		LOGGER.log(Level.INFO, "Ptrace file has been created successfully");
	}

	/**
	 * Add headers to ptrace file
	 * 
	 * @param br
	 * @throws Exception
	 */
	static void addHeaders(BufferedWriter br) throws Exception {

		br.write("L2_left");
		br.write("\t");
		br.write("L2");
		br.write("\t");
		br.write("L2_right");
		br.write("\t");
		br.write("Icache");
		br.write("\t");
		br.write("Dcache");
		br.write("\t");
		br.write("Bpred");
		br.write("\t");
		br.write("DTB");
		br.write("\t");
		br.write("FPAdd");
		br.write("\t");
		br.write("FPReg");
		br.write("\t");
		br.write("FPMul");
		br.write("\t");
		br.write("FPMap");
		br.write("\t");
		br.write("IntMap");
		br.write("\t");
		br.write("IntQ");
		br.write("\t");
		br.write("IntReg");
		br.write("\t");
		br.write("IntExec");
		br.write("\t");
		br.write("FPQ");
		br.write("\t");
		br.write("LdStQ");
		br.write("\t");
		br.write("ITB");
		br.write("\n");
	}

	static void preparePtraceFile(ArrayList<ArrayList<String>> ptrace) throws Exception {
		BufferedWriter br = new BufferedWriter(new FileWriter("input.ptrace"));
		int len = safeToGo(ptrace);
		addHeaders(br);
		for (int i = 0; i < len; i++) {
			br.write(ptrace.get(0).get(i));
			br.write("\t");
			br.write(ptrace.get(1).get(i));
			br.write("\t");
			br.write(ptrace.get(2).get(i));
			br.write("\t");
			br.write(ptrace.get(3).get(i));
			br.write("\t");
			br.write(ptrace.get(4).get(i));
			br.write("\t");
			br.write(ptrace.get(5).get(i));
			br.write("\t");
			br.write(ptrace.get(6).get(i));
			br.write("\t");
			br.write(ptrace.get(7).get(i));
			br.write("\t");
			br.write(ptrace.get(8).get(i));
			br.write("\t");
			br.write(ptrace.get(9).get(i));
			br.write("\t");
			br.write(ptrace.get(10).get(i));
			br.write("\t");
			br.write(ptrace.get(11).get(i));
			br.write("\t");
			br.write(ptrace.get(12).get(i));
			br.write("\t");
			br.write(ptrace.get(13).get(i));
			br.write("\t");
			br.write(ptrace.get(14).get(i));
			br.write("\t");
			br.write(ptrace.get(15).get(i));
			br.write("\t");
			br.write(ptrace.get(16).get(i));
			br.write("\t");
			br.write(ptrace.get(17).get(i));
			br.write("\n");
		}
		br.close();
	}

	static int safeToGo(ArrayList<ArrayList<String>> ptrace) {
		int size = Integer.MAX_VALUE;
		for (Iterator iterator = ptrace.iterator(); iterator.hasNext();) {
			ArrayList<String> arrayList = (ArrayList<String>) iterator.next();
			if (size > arrayList.size()) {
				size = arrayList.size();
			}
		}
		return size;
	}

	static String readAllLines(String fileName) {
		StringBuffer lines = new StringBuffer();
		BufferedReader br;
		try {
			br = new BufferedReader(new FileReader(fileName));
			// home/iiita/workspace/macpatparser

			String line = null;

			while ((line = br.readLine()) != null) {
				lines.append(line);
				lines.append("\n");
			}
		} catch (IOException e) {
			// TODO Auto-generated catch block
			LOGGER.log(Level.CONFIG, fileName + " : File not exist");
			System.exit(0);
		}
		return lines.toString();
	}

	static ArrayList<String> getStats(String searchp, String logs) {
		ArrayList<String> pstace = new ArrayList<String>();
		Scanner scanner = new Scanner(logs);
		while (scanner.hasNextLine()) {
			String line = scanner.nextLine().trim();
			if (line.contentEquals(searchp)) {
				scanner.nextLine();
				scanner.nextLine();
				scanner.nextLine();
				scanner.nextLine();
				line = scanner.nextLine();

				// pstace.add(line.split("\\s+")[4]);
				String str = line.split("\\s+")[4];

				if (str.contains("e")) {
					BigDecimal d = new BigDecimal(str);
					str = d.toPlainString();
				}
				pstace.add(str);
			}
		}
		// System.out.println(searchp + " " + pstace);
		scanner.close();
		return pstace;
	}

}
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

Reply via email to