Andrew:
  Thanks for this report. Tottime is second or microsecond? If LoadToolDefFile 
is called only once, how much performance can be saved?

Thanks
Liming
-----Original Message-----
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Andrew 
Fish
Sent: Tuesday, February 16, 2016 5:42 PM
To: edk2-devel@lists.01.org <edk2-de...@ml01.01.org>
Subject: [edk2] Why is the tools_def.txt file parsed 47 times on my fds build?


I turned on profiling in Python:
BaseTools/BinWrappers/PosixLike/RunToolFromSource:
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
PYTHONPATH="`dirname $0`/../../Source/Python" \
    python -m cProfile -s time "`dirname $0`/../../Source/Python"/`basename 
$0`/`basename $0`.py $*


The slowest item in the working thread was ToolDefClassObject. LoadToolDefFile()

   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
       47    8.932    0.190   10.986    0.234 
ToolDefClassObject.py:60(LoadToolDefFile)
  4067478    1.337    0.000    1.337    0.000 {method 'split' of 'str' objects}
    28519    1.064    0.000    1.064    0.000 {method 'execute' of 
'sqlite3.Cursor' objects}
   733378    0.826    0.000    1.161    0.000 StringIO.py:208(write)
       71    0.613    0.009    0.613    0.009 {method 'items' of 'dict' objects}
       23    0.499    0.022   11.905    0.518 
GuidSection.py:245(__FindExtendTool__)


I see it gets called at the beginning of the build from InitBuild() and that 
makes sense. If I do a genmake build LoadToolDefFile() only gets called a 
single time. 

But it looks like __FindExtendTool__ is also making calls:
 ToolDefinition = 
ToolDefClassObject.ToolDefDict(GenFdsGlobalVariable.ConfDir).ToolsDefTxtDictionary

So it looks to me like class GuidSection() is parsing the tools_def.txt for 
every GUID'ed section that has a GUID defined tool? How come this information 
is not cached? 

Does anyone see a quick fix?

Thanks,

Andrew Fish 
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to