winpty/winpty.gyp
Ryan Prichard 3b73576ab9 Consolidate console read API calls.
* Instead of reading the output line-by-line, figure out what lines we
   need ahead-of-time and issue as few read calls as possible.  On Windows
   8 and up, we issue just one read call.  On earlier versions, we avoid
   reading more than a certain amount.

 * This change reduces the CPU usage.  e.g. In my Windows 10 VM, the idle
   CPU usage of winpty-agent.exe+conhost.exe combined, with an empty
   console, dropped from ~3.6% to ~1.4%.  In a Windows 7 VM, I measured a
   reduction of CPU from ~1.6% to 0.6%.

 * Increase the MAX_CONSOLE_WIDTH from 500 to 2500.  The limiting factor
   now is that LargeConsoleRead reads at least one line at a line, but we
   don't want to read more than 2500 characters in one call on old operating
   systems.

 * Fix the attribute handling in scanForDirtyLines.  (The assignment to
   newAttr was dead.)

The 2500 limit is arbitrary and could probably be increased.  The actual
hard limit depends on the OS and is around 17000.  My understanding is that
the limit is based upon the need to allocate I/O buffers within a shared
64KiB heap, and I'm worried about heap fragmentation.  I know that 2500
is safe, because winpty has been issuing reads of almost 3000 characters
already to find the sync marker.

Fixes https://github.com/rprichard/winpty/issues/44
2015-10-16 15:26:45 -05:00

95 lines
2.8 KiB
Python

{
'targets' : [
{
'target_name' : 'winpty-agent',
'type' : 'executable',
'include_dirs' : [
'include',
],
'defines' : [
'UNICODE',
'_UNICODE',
'_WIN32_WINNT=0x0501',
'NOMINMAX',
],
'libraries' : [
'-luser32.lib',
],
'sources' : [
'agent/Agent.h',
'agent/Agent.cc',
'agent/AgentAssert.h',
'agent/AgentAssert.cc',
'agent/ConsoleFont.cc',
'agent/ConsoleFont.h',
'agent/ConsoleInput.cc',
'agent/ConsoleInput.h',
'agent/ConsoleLine.cc',
'agent/ConsoleLine.h',
'agent/Coord.h',
'agent/Coord.cc',
'agent/DsrSender.h',
'agent/EventLoop.cc',
'agent/LargeConsoleRead.h',
'agent/LargeConsoleRead.cc',
'agent/NamedPipe.h',
'agent/NamedPipe.cc',
'agent/SmallRect.h',
'agent/SmallRect.cc',
'agent/Terminal.h',
'agent/Terminal.cc',
'agent/UnicodeEncoding.h',
'agent/Win32Console.cc',
'agent/Win32Console.h',
'agent/main.cc',
'agent/winpty_wcsnlen.cc',
'agent/winpty_wcsnlen.h',
'shared/AgentMsg.h',
'shared/Buffer.h',
'shared/DebugClient.h',
'shared/DebugClient.cc',
'shared/c99_snprintf.h',
],
},
{
'target_name' : 'winpty',
'type' : 'shared_library',
'include_dirs' : [
'include',
],
'defines' : [
'UNICODE',
'_UNICODE',
'_WIN32_WINNT=0x0501',
'NOMINMAX',
'WINPTY',
],
'libraries' : [
'-luser32.lib',
],
'sources' : [
'include/winpty.h',
'libwinpty/winpty.cc',
'shared/AgentMsg.h',
'shared/Buffer.h',
'shared/DebugClient.h',
'shared/DebugClient.cc',
'shared/c99_snprintf.h',
],
},
{
'target_name' : 'winpty-debugserver',
'type' : 'executable',
'defines' : [
'UNICODE',
'_UNICODE',
'_WIN32_WINNT=0x0501',
'NOMINMAX',
],
'sources' : [
'debugserver/DebugServer.cc',
],
}
],
}