Current memory profile feature:
1. Shows which line of code calls gBS->AllocateXXX(). But most entries
are from MemoryAllocationLib.
2. Records at the start.
3. Records all modules.

Enhanced memory profile feature:
1. User can know which line of code calls AllocateXXX() API instead of
gBS->Allocate().
2. User can know which line of code calls a specific API that will call
AllocateXXX().
3. User can know total memory allocated by a specific line of code.
4. User can configure to record single module.
5. User can configure when to enable recording.
6. User can know RVA<->Symbol (Function, Source, Line).

V2:
1. Add [03/11] to add lock to pretect memory profile AllocInfo list.
2. Update [09/11] and [10/11] to use seperated inf to support both
MemoryAllocateLib and MemoryProfileLib.

Cc: Jiewen Yao <jiewen....@intel.com>
Cc: Liming Gao <liming....@intel.com>
Cc: Yonghong Zhu <yonghong....@intel.com>

Star Zeng (11):
  MdeModulePkg: Extend memory profile definitions for memory leak
    detection
  MdeModulePkg DxeCore: Enhance memory profile for memory leak detection
  MdeModulePkg DxeCore: Add lock to pretect memory profile AllocInfo
    list
  MdeModulePkg PiSmmCore: Enhance memory profile for memory leak
    detection
  MdeModulePkg MemoryProfileInfo: Enhance output info for memory leak
    detection
  MdeModulePkg: Introduce new library class MemoryProfileLib
  MdeModulePkg: Implement new library instance
    UefiMemoryAllocationProfileLib
  MdeModulePkg: Implement new library instance
    SmmMemoryAllocationProfileLib
  MdeModulePkg DxeCoreMemoryAllocationLib: Extend to support
    MemoryProfileLib
  MdeModulePkg PiSmmCoreMemoryAllocLib:  Extend to support
    MemoryProfileLib
  BaseTools Scripts: Add MemoryProfileSymbolGen.py

 BaseTools/Scripts/MemoryProfileSymbolGen.py        |  281 +++++
 .../MemoryProfileInfo/MemoryProfileInfo.c          |  884 ++++++++++---
 .../MemoryProfileInfo/MemoryProfileInfo.inf        |    3 +-
 MdeModulePkg/Core/Dxe/DxeMain.h                    |   35 +-
 MdeModulePkg/Core/Dxe/DxeMain.inf                  |    1 +
 MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c    |  844 +++++++++----
 MdeModulePkg/Core/Dxe/Mem/Page.c                   |   18 +-
 MdeModulePkg/Core/Dxe/Mem/Pool.c                   |   18 +-
 MdeModulePkg/Core/PiSmmCore/Page.c                 |   20 +-
 MdeModulePkg/Core/PiSmmCore/PiSmmCore.c            |    3 +-
 MdeModulePkg/Core/PiSmmCore/PiSmmCore.h            |   57 +-
 MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf          |    6 +-
 MdeModulePkg/Core/PiSmmCore/Pool.c                 |   20 +-
 MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c   | 1319 +++++++++++++++-----
 MdeModulePkg/Include/Guid/MemoryProfile.h          |  189 ++-
 MdeModulePkg/Include/Library/MemoryProfileLib.h    |   53 +
 .../DxeCoreMemoryAllocationLib.inf                 |   13 +-
 .../DxeCoreMemoryAllocationLib.uni                 |    4 +-
 ...b.inf => DxeCoreMemoryAllocationProfileLib.inf} |   24 +-
 .../DxeCoreMemoryAllocationProfileLib.uni          |   23 +
 .../DxeCoreMemoryProfileLib.c                      |   57 +
 .../DxeCoreMemoryProfileLibNull.c                  |   55 +
 .../DxeCoreMemoryProfileServices.h                 |   54 +
 .../MemoryAllocationLib.c                          |  277 +++-
 .../MemoryAllocationLib.c                          |  188 ++-
 .../PiSmmCoreMemoryAllocationLib.inf               |   11 +-
 .../PiSmmCoreMemoryAllocationLib.uni               |    4 +-
 ...inf => PiSmmCoreMemoryAllocationProfileLib.inf} |   26 +-
 .../PiSmmCoreMemoryAllocationProfileLib.uni        |   23 +
 .../PiSmmCoreMemoryProfileLib.c                    |  123 ++
 .../PiSmmCoreMemoryProfileLibNull.c                |   54 +
 .../PiSmmCoreMemoryProfileServices.h               |   54 +
 .../MemoryAllocationLib.c                          |  613 ++++++---
 .../SmmMemoryAllocationProfileLib.inf              |   62 +
 .../SmmMemoryAllocationProfileLib.uni              |   23 +
 .../SmmMemoryProfileLib.c                          |  143 +++
 .../DxeMemoryProfileLib.c                          |  102 ++
 .../MemoryAllocationLib.c                          |  312 ++++-
 .../UefiMemoryAllocationProfileLib.inf             |   53 +
 .../UefiMemoryAllocationProfileLib.uni             |   23 +
 MdeModulePkg/MdeModulePkg.dec                      |   20 +
 MdeModulePkg/MdeModulePkg.dsc                      |    5 +
 MdeModulePkg/MdeModulePkg.uni                      |   17 +-
 43 files changed, 5081 insertions(+), 1033 deletions(-)
 create mode 100644 BaseTools/Scripts/MemoryProfileSymbolGen.py
 create mode 100644 MdeModulePkg/Include/Library/MemoryProfileLib.h
 copy 
MdeModulePkg/Library/DxeCoreMemoryAllocationLib/{DxeCoreMemoryAllocationLib.inf 
=> DxeCoreMemoryAllocationProfileLib.inf} (56%)
 create mode 100644 
MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationProfileLib.uni
 create mode 100644 
MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryProfileLib.c
 create mode 100644 
MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryProfileLibNull.c
 create mode 100644 
MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryProfileServices.h
 copy 
MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/{PiSmmCoreMemoryAllocationLib.inf
 => PiSmmCoreMemoryAllocationProfileLib.inf} (54%)
 create mode 100644 
MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryAllocationProfileLib.uni
 create mode 100644 
MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryProfileLib.c
 create mode 100644 
MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryProfileLibNull.c
 create mode 100644 
MdeModulePkg/Library/PiSmmCoreMemoryAllocationLib/PiSmmCoreMemoryProfileServices.h
 copy MdeModulePkg/Library/{PiSmmCoreMemoryAllocationLib => 
SmmMemoryAllocationProfileLib}/MemoryAllocationLib.c (55%)
 create mode 100644 
MdeModulePkg/Library/SmmMemoryAllocationProfileLib/SmmMemoryAllocationProfileLib.inf
 create mode 100644 
MdeModulePkg/Library/SmmMemoryAllocationProfileLib/SmmMemoryAllocationProfileLib.uni
 create mode 100644 
MdeModulePkg/Library/SmmMemoryAllocationProfileLib/SmmMemoryProfileLib.c
 create mode 100644 
MdeModulePkg/Library/UefiMemoryAllocationProfileLib/DxeMemoryProfileLib.c
 copy MdeModulePkg/Library/{DxeCoreMemoryAllocationLib => 
UefiMemoryAllocationProfileLib}/MemoryAllocationLib.c (74%)
 create mode 100644 
MdeModulePkg/Library/UefiMemoryAllocationProfileLib/UefiMemoryAllocationProfileLib.inf
 create mode 100644 
MdeModulePkg/Library/UefiMemoryAllocationProfileLib/UefiMemoryAllocationProfileLib.uni

-- 
2.7.0.windows.1

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

Reply via email to