On 12/03/15 06:35, Qiu Shumin wrote:
> In some platform 'map -r' may cost more than 1 min. This patch filter the 
> target handles by
> BlockIO and SimpleFileSystem protocol to reduce the time cost.

Hijacking this thread and asking a more general question -- I noticed
recently that the "devices" and "drivers" commands can take quite long.
I guess there is a lot of processing to be done for those. But, has it
been considered to change the internal representation of the protocol
database to speed things up? (I'm asking this without knowing too much
about the current representation.)

I'm not suggesting that the current proto DB representation is slow; I'm
just curious if the perf consequences of the representation have been
considered before.

Thanks!
Laszlo

> 
> Cc: Jaben Carsey <jaben.car...@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Qiu Shumin <shumin....@intel.com>
> ---
>  .../Library/UefiShellCommandLib/ConsistMapping.c   | 40 
> ++++++++++++++++------
>  1 file changed, 30 insertions(+), 10 deletions(-)
> 
> diff --git a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c 
> b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
> index 9bd7b2c..86e8dc5 100644
> --- a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
> +++ b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
> @@ -16,6 +16,10 @@
>  #include <Library/SortLib.h>
>  #include <Library/UefiLib.h>
>  #include <Protocol/UsbIo.h>
> +#include <Protocol/BlockIo.h>
> +#include <Protocol/SimpleFileSystem.h>
> +
> +
>  
>  typedef enum {
>    MTDTypeUnknown,
> @@ -1349,20 +1353,22 @@ ShellCommandConsistMappingInitialize (
>    OUT EFI_DEVICE_PATH_PROTOCOL           ***Table
>    )
>  {
> -  EFI_HANDLE                *HandleBuffer;
> -  UINTN                     HandleNum;
> -  UINTN                     HandleLoop;
> -  EFI_DEVICE_PATH_PROTOCOL  **TempTable;
> -  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
> -  EFI_DEVICE_PATH_PROTOCOL  *HIDevicePath;
> -  UINTN                     Index;
> -  EFI_STATUS                Status;
> +  EFI_HANDLE                      *HandleBuffer;
> +  UINTN                           HandleNum;
> +  UINTN                           HandleLoop;
> +  EFI_DEVICE_PATH_PROTOCOL        **TempTable;
> +  EFI_DEVICE_PATH_PROTOCOL        *DevicePath;
> +  EFI_DEVICE_PATH_PROTOCOL        *HIDevicePath;
> +  EFI_BLOCK_IO_PROTOCOL           *BlockIo;
> +  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *SimpleFileSystem;
> +  UINTN                           Index;
> +  EFI_STATUS                      Status;
>  
>    HandleBuffer              = NULL;
>  
>    Status = gBS->LocateHandleBuffer (
> -              AllHandles,
> -              NULL,
> +              ByProtocol,
> +              &gEfiDevicePathProtocolGuid,
>                NULL,
>                &HandleNum,
>                &HandleBuffer
> @@ -1385,6 +1391,20 @@ ShellCommandConsistMappingInitialize (
>        continue;
>      }
>  
> +    Status = gBS->HandleProtocol( HandleBuffer[HandleLoop], 
> +                                  &gEfiBlockIoProtocolGuid, 
> +                                  (VOID **)&BlockIo
> +                                  );
> +    if (EFI_ERROR(Status)) {
> +      Status = gBS->HandleProtocol( HandleBuffer[HandleLoop], 
> +                                    &gEfiSimpleFileSystemProtocolGuid, 
> +                                    (VOID **)&SimpleFileSystem
> +                                    );
> +      if (EFI_ERROR(Status)) {
> +        continue;
> +      }
> +    }
> +
>      for (Index = 0; TempTable[Index] != NULL; Index++) {
>        if (DevicePathCompare (&TempTable[Index], &HIDevicePath) == 0) {
>          FreePool (HIDevicePath);
> 

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

Reply via email to