parameters:
- name: InstallLanguageSteps
  type: object
  default: []
- name: ServiceDirectory
  type: string
  default: ''
- name: PackageVersions
  type: string
  default: '.*'
- name: Tests
  type: string
  default: '.*'
- name: Arguments
  type: string
  default: '.*' 
- name: Iterations
  type: number
  default: '5'
- name: AdditionalArguments
  type: string
  default: ''
- name: Profile
  type: boolean
  default: false
- name: EnvVars
  type: object
  default: []

extends:
  template: /eng/common/pipelines/templates/jobs/perf.yml
  parameters:
    Variables:
    - template: /eng/pipelines/templates/variables/globals.yml
    Language: Cpp
    LanguageVersion: 'N/A'
    InstallLanguageSteps:
      - pwsh: |
          Write-Host "##vso[task.setvariable variable=VCPKG_BINARY_SOURCES_SECRET;issecret=true;]clear;x-azblob,https://cppvcpkgcache.blob.core.windows.net/public-vcpkg-container,,read"
        displayName: Set Vcpkg Variables
      - ${{ if parameters.Profile }}:
        - task: Bash@3
          inputs:
            targetType: 'inline'
            script: sudo apt install valgrind -y
            displayName: Install valgrind
      - template: /eng/common/testproxy/test-proxy-tool.yml
        parameters:
          runProxy: true
          rootFolder: '$(Build.SourcesDirectory)/sdk/${{parameters.ServiceDirectory}}'
          templateFolder: '$(Build.SourcesDirectory)/sdk/${{parameters.ServiceDirectory}}'

    ServiceDirectory: ${{ parameters.ServiceDirectory }}
    PackageVersions: ${{ parameters.PackageVersions }}
    Tests: ${{ parameters.Tests }}
    Arguments: ${{ parameters.Arguments }}
    Iterations: ${{ parameters.Iterations }}
    AdditionalArguments: ${{ parameters.AdditionalArguments }}
    Profile: ${{ parameters.Profile }}
    EnvVars: ${{ parameters.EnvVars}}
