/* Copies the string from Source into Destination and updates Length with the size of the string. */
VOID CopyStringIntoPerfRecordAndUpdateLength(IN OUT CHAR8 *Destination, IN CONST CHAR8 *Source, IN OUT UINT8 *Length)
/* Copies the string from Source into Destination and updates Length with the size of the string. */
VOID CopyStringIntoPerfRecordAndUpdateLength(IN OUT CHAR8 *Destination, IN CONST CHAR8 *Source, IN OUT UINT8 *Length)
{
  UINTN  StringLen;
  UINTN  DestMax;
  ASSERT (Source != NULL);
  if (PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) {
    DestMax = STRING_SIZE;
  } else {
    DestMax = AsciiStrSize (Source);
    if (DestMax > STRING_SIZE) {
      DestMax = STRING_SIZE;
    }
  }
  StringLen = AsciiStrLen (Source);
  if (StringLen >= DestMax) {
    StringLen = DestMax -1;
  }
  AsciiStrnCpyS (Destination, DestMax, Source, StringLen);
  *Length += (UINT8)DestMax;
  return;
}