-
Notifications
You must be signed in to change notification settings - Fork 8.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add benchcat: cat + throughput measurements #15564
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0b1b099
Add benchcat: cat + throughput measurements
lhecker d50c77d
Fix buffer_append_number
lhecker 368de6b
Fix build issues
lhecker 233416f
Fix unicode path support, Restore console mode/page
lhecker 6a32d16
Fix formatting of bytes
lhecker 251e68b
Remove all of the tools from the .sln build
lhecker ca76b79
Restore most of the .sln
lhecker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -420,6 +420,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TerminalStress", "src\tools | |
EndProject | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenderingTests", "src\tools\RenderingTests\RenderingTests.vcxproj", "{37C995E0-2349-4154-8E77-4A52C0C7F46D}" | ||
EndProject | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "benchcat", "src\tools\benchcat\benchcat.vcxproj", "{2C836962-9543-4CE5-B834-D28E1F124B66}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
AuditMode|Any CPU = AuditMode|Any CPU | ||
|
@@ -2798,6 +2800,32 @@ Global | |
{37C995E0-2349-4154-8E77-4A52C0C7F46D}.Release|x64.Build.0 = Release|x64 | ||
{37C995E0-2349-4154-8E77-4A52C0C7F46D}.Release|x86.ActiveCfg = Release|Win32 | ||
{37C995E0-2349-4154-8E77-4A52C0C7F46D}.Release|x86.Build.0 = Release|Win32 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.AuditMode|Any CPU.ActiveCfg = AuditMode|Win32 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.AuditMode|ARM.ActiveCfg = AuditMode|Win32 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.AuditMode|ARM64.ActiveCfg = Release|ARM64 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.AuditMode|x64.ActiveCfg = Release|x64 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.AuditMode|x86.ActiveCfg = Release|Win32 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.Debug|Any CPU.ActiveCfg = Debug|Win32 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.Debug|ARM.ActiveCfg = Debug|Win32 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.Debug|ARM64.ActiveCfg = Debug|ARM64 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.Debug|ARM64.Build.0 = Debug|ARM64 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.Debug|x64.ActiveCfg = Debug|x64 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.Debug|x64.Build.0 = Debug|x64 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.Debug|x86.ActiveCfg = Debug|Win32 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.Debug|x86.Build.0 = Debug|Win32 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.Fuzzing|Any CPU.ActiveCfg = Fuzzing|Win32 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.Fuzzing|ARM.ActiveCfg = Fuzzing|Win32 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.Fuzzing|ARM64.ActiveCfg = Fuzzing|ARM64 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.Fuzzing|x64.ActiveCfg = Fuzzing|x64 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.Fuzzing|x86.ActiveCfg = Fuzzing|Win32 | ||
Comment on lines
+2807
to
+2811
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably don't need this for Fuzzing right? |
||
{2C836962-9543-4CE5-B834-D28E1F124B66}.Release|Any CPU.ActiveCfg = Release|Win32 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.Release|ARM.ActiveCfg = Release|Win32 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.Release|ARM64.ActiveCfg = Release|ARM64 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.Release|ARM64.Build.0 = Release|ARM64 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.Release|x64.ActiveCfg = Release|x64 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.Release|x64.Build.0 = Release|x64 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.Release|x86.ActiveCfg = Release|Win32 | ||
{2C836962-9543-4CE5-B834-D28E1F124B66}.Release|x86.Build.0 = Release|Win32 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
|
@@ -2904,6 +2932,7 @@ Global | |
{3C67784E-1453-49C2-9660-483E2CC7F7AD} = {40BD8415-DD93-4200-8D82-498DDDC08CC8} | ||
{613CCB57-5FA9-48EF-80D0-6B1E319E20C4} = {A10C4720-DCA4-4640-9749-67F4314F527C} | ||
{37C995E0-2349-4154-8E77-4A52C0C7F46D} = {A10C4720-DCA4-4640-9749-67F4314F527C} | ||
{2C836962-9543-4CE5-B834-D28E1F124B66} = {A10C4720-DCA4-4640-9749-67F4314F527C} | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {3140B1B7-C8EE-43D1-A772-D82A7061A271} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup Label="Globals"> | ||
<VCProjectVersion>16.0</VCProjectVersion> | ||
<Keyword>Win32Proj</Keyword> | ||
<ProjectGuid>{2C836962-9543-4CE5-B834-D28E1F124B66}</ProjectGuid> | ||
<RootNamespace>benchcat</RootNamespace> | ||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> | ||
<TargetName>bc</TargetName> | ||
</PropertyGroup> | ||
<Import Project="$(SolutionDir)\src\common.build.pre.props" /> | ||
<ItemDefinitionGroup> | ||
<ClCompile> | ||
<PrecompiledHeader>NotUsing</PrecompiledHeader> | ||
</ClCompile> | ||
<Link> | ||
<SubSystem>Console</SubSystem> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<PropertyGroup Condition="'$(Configuration)'=='Release'"> | ||
<GenerateManifest>false</GenerateManifest> | ||
<WholeProgramOptimization>false</WholeProgramOptimization> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'"> | ||
<ClCompile> | ||
<BufferSecurityCheck>false</BufferSecurityCheck> | ||
<ControlFlowGuard>false</ControlFlowGuard> | ||
<ExceptionHandling>false</ExceptionHandling> | ||
<PreprocessorDefinitions>NODEFAULTLIB;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<SDLCheck>false</SDLCheck> | ||
</ClCompile> | ||
<Link> | ||
<EntryPointSymbol>main</EntryPointSymbol> | ||
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemGroup> | ||
<ClCompile Include="main.cpp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="crt.cpp" /> | ||
</ItemGroup> | ||
<Import Project="$(SolutionDir)\src\common.build.post.props" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,224 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
#ifdef NODEFAULTLIB | ||
|
||
#include <intrin.h> | ||
|
||
#pragma function(memcpy) | ||
void* memcpy(void* dst, const void* src, size_t size) | ||
{ | ||
__movsb(static_cast<BYTE*>(dst), static_cast<const BYTE*>(src), size); | ||
return dst; | ||
} | ||
|
||
#pragma function(memset) | ||
void* memset(void* dst, int val, size_t size) | ||
{ | ||
__stosb(static_cast<BYTE*>(dst), static_cast<BYTE>(val), size); | ||
return dst; | ||
} | ||
|
||
#endif | ||
|
||
namespace ucrt | ||
{ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// | ||
// This is a copy of "startup/argv_parsing.cpp" from the Windows SDK (10.0.22000.0). | ||
// The source code was slightly modified to fit this code style. | ||
|
||
template<typename Character> | ||
static bool should_copy_another_character(Character) noexcept | ||
{ | ||
return false; | ||
} | ||
|
||
template<typename Character> | ||
static void __cdecl parse_command_line(Character* cmdstart, Character** argv, Character* args, size_t* argument_count, size_t* character_count) noexcept | ||
{ | ||
*character_count = 0; | ||
*argument_count = 1; // We'll have at least the program name | ||
|
||
Character c; | ||
int copy_character; /* 1 = copy char to *args */ | ||
unsigned numslash; /* num of backslashes seen */ | ||
|
||
/* first scan the program name, copy it, and count the bytes */ | ||
Character* p = cmdstart; | ||
if (argv) | ||
*argv++ = args; | ||
|
||
// A quoted program name is handled here. The handling is much | ||
// simpler than for other arguments. Basically, whatever lies | ||
// between the leading double-quote and next one, or a terminal null | ||
// character is simply accepted. Fancier handling is not required | ||
// because the program name must be a legal NTFS/HPFS file name. | ||
// Note that the double-quote characters are not copied, nor do they | ||
// contribute to character_count. | ||
bool in_quotes = false; | ||
do | ||
{ | ||
if (*p == '"') | ||
{ | ||
in_quotes = !in_quotes; | ||
c = *p++; | ||
continue; | ||
} | ||
|
||
++*character_count; | ||
if (args) | ||
*args++ = *p; | ||
|
||
c = *p++; | ||
|
||
if (should_copy_another_character(c)) | ||
{ | ||
++*character_count; | ||
if (args) | ||
*args++ = *p; // Copy 2nd byte too | ||
++p; // skip over trail byte | ||
} | ||
} while (c != '\0' && (in_quotes || (c != ' ' && c != '\t'))); | ||
|
||
if (c == '\0') | ||
{ | ||
p--; | ||
} | ||
else | ||
{ | ||
if (args) | ||
*(args - 1) = '\0'; | ||
} | ||
|
||
in_quotes = false; | ||
|
||
// Loop on each argument | ||
for (;;) | ||
{ | ||
if (*p) | ||
{ | ||
while (*p == ' ' || *p == '\t') | ||
++p; | ||
} | ||
|
||
if (*p == '\0') | ||
break; // End of arguments | ||
|
||
// Scan an argument: | ||
if (argv) | ||
*argv++ = args; | ||
|
||
++*argument_count; | ||
|
||
// Loop through scanning one argument: | ||
for (;;) | ||
{ | ||
copy_character = 1; | ||
|
||
// Rules: | ||
// 2N backslashes + " ==> N backslashes and begin/end quote | ||
// 2N + 1 backslashes + " ==> N backslashes + literal " | ||
// N backslashes ==> N backslashes | ||
numslash = 0; | ||
|
||
while (*p == '\\') | ||
{ | ||
// Count number of backslashes for use below | ||
++p; | ||
++numslash; | ||
} | ||
|
||
if (*p == '"') | ||
{ | ||
// if 2N backslashes before, start/end quote, otherwise | ||
// copy literally: | ||
if (numslash % 2 == 0) | ||
{ | ||
if (in_quotes && p[1] == '"') | ||
{ | ||
p++; // Double quote inside quoted string | ||
} | ||
else | ||
{ | ||
// Skip first quote char and copy second: | ||
copy_character = 0; // Don't copy quote | ||
in_quotes = !in_quotes; | ||
} | ||
} | ||
|
||
numslash /= 2; | ||
} | ||
|
||
// Copy slashes: | ||
while (numslash--) | ||
{ | ||
if (args) | ||
*args++ = '\\'; | ||
++*character_count; | ||
} | ||
|
||
// If at end of arg, break loop: | ||
if (*p == '\0' || (!in_quotes && (*p == ' ' || *p == '\t'))) | ||
break; | ||
|
||
// Copy character into argument: | ||
if (copy_character) | ||
{ | ||
if (args) | ||
*args++ = *p; | ||
|
||
if (should_copy_another_character(*p)) | ||
{ | ||
++p; | ||
++*character_count; | ||
|
||
if (args) | ||
*args++ = *p; | ||
} | ||
|
||
++*character_count; | ||
} | ||
|
||
++p; | ||
} | ||
|
||
// Null-terminate the argument: | ||
if (args) | ||
*args++ = '\0'; // Terminate the string | ||
|
||
++*character_count; | ||
} | ||
|
||
// We put one last argument in -- a null pointer: | ||
if (argv) | ||
*argv++ = nullptr; | ||
|
||
++*argument_count; | ||
} | ||
|
||
char* acrt_allocate_buffer_for_argv(size_t const argument_count, size_t const character_count, size_t const character_size) | ||
{ | ||
const size_t argument_array_size = argument_count * sizeof(void*); | ||
const size_t character_array_size = character_count * character_size; | ||
const size_t total_size = argument_array_size + character_array_size; | ||
return reinterpret_cast<char*>(VirtualAlloc(nullptr, total_size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE)); | ||
} | ||
|
||
static void common_configure_argv(const char*** argv, int* argc) | ||
{ | ||
const auto command_line = GetCommandLineA(); | ||
|
||
size_t argument_count = 0; | ||
size_t character_count = 0; | ||
ucrt::parse_command_line<char>(command_line, nullptr, nullptr, &argument_count, &character_count); | ||
|
||
const auto buffer = ucrt::acrt_allocate_buffer_for_argv(argument_count, character_count, sizeof(char)); | ||
const auto first_argument = reinterpret_cast<char**>(buffer); | ||
const auto first_string = reinterpret_cast<char*>(buffer + argument_count * sizeof(char*)); | ||
ucrt::parse_command_line(command_line, first_argument, first_string, &argument_count, &character_count); | ||
|
||
*argv = const_cast<const char**>(first_argument); | ||
*argc = static_cast<int>(argument_count - 1); | ||
} | ||
} // namespace ucrt |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want this for audit mode too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We must include a configuration mapping for every platform|config combo in the solution.
Since these do not have a
.0
entry (instead of.ActiveCfg
), they will not be considered for build.This and the above are in the correct state :)