summaryrefslogtreecommitdiff
path: root/lib/Support/Windows/Process.inc
Commit message (Collapse)AuthorAge
* Windows: Avoiding resizing, use uninitialized data() insteadDavid Majnemer2013-10-07
| | | | | | | This is ever-so faster but more importantly matches what we have elsewhere. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192137 91177308-0d34-0410-b5e6-96231b3b80d8
* Windows/Process.inc: Fix for +Asserts. &Buf[0] is not guaranteed if size is ↵NAKAMURA Takumi2013-10-07
| | | | | | zero. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192103 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Revert "Windows: Add support for unicode command lines""David Majnemer2013-10-07
| | | | | | | | This reverts commit r192070 which reverted r192069, I forgot to regenerate the configure scripts. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192079 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Windows: Add support for unicode command lines"David Majnemer2013-10-06
| | | | | | | | This is causing MinGW bots to fail. This reverts commit r192069. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192070 91177308-0d34-0410-b5e6-96231b3b80d8
* Windows: Add support for unicode command linesDavid Majnemer2013-10-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: The MSVCRT deliberately sends main() code-page specific characters. This isn't too useful to LLVM as we end up converting the arguments to UTF-16 and subsequently attempt to use the result as, for example, a file name. Instead, we need to have the ability to access the Unicode command line and transform it to UTF-8. This has the distinct advantage over using the MSVC-specific wmain() function as our entry point because: - It doesn't work on cygwin. - It only work on MinGW with caveats and only then on certain versions. - We get to keep our entry point as main(). :) N.B. This patch includes fixes to other parts of lib/Support/Windows s.t. we would be able to take advantage of getting the Unicode paths. E.G. clang spawning clang -cc1 would want to give it Unicode arguments. Reviewers: aaron.ballman, Bigcheese, rnk, ruiu Reviewed By: rnk CC: llvm-commits, ygao Differential Revision: http://llvm-reviews.chandlerc.com/D1834 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192069 91177308-0d34-0410-b5e6-96231b3b80d8
* Support ANSI escape code on WindowsNico Rieck2013-09-11
| | | | | | | | In some cases (e.g. when a build system pipes stderr) the Windows console API cannot be used to color output. For these, provide a way to switch to ANSI escape codes. This is required for Clang's -fansi-escape-codes option. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190460 91177308-0d34-0410-b5e6-96231b3b80d8
* Add getenv() wrapper that works on multibyte environment variable.Rui Ueyama2013-09-10
| | | | | | | | | | | | | | | | | | On Windows, character encoding of multibyte environment variable varies depending on settings. The only reliable way to handle it I think is to use GetEnvironmentVariableW(). GetEnvironmentVariableW() works on wchar_t string, which is on Windows UTF16 string. That's not ideal because we use UTF-8 as the internal encoding in LLVM. This patch defines a wrapper function which takes and returns UTF-8 string for GetEnvironmentVariableW(). The wrapper function does not do any conversion and just forwards the argument to getenv() on Unix. Differential Revision: http://llvm-reviews.chandlerc.com/D1612 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@190423 91177308-0d34-0410-b5e6-96231b3b80d8
* Support/Process: Add comments about PageSize and AllocationGranularity on ↵NAKAMURA Takumi2013-09-04
| | | | | | Cygwin and Win32. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189940 91177308-0d34-0410-b5e6-96231b3b80d8
* Removing unused functionality.Aaron Ballman2013-08-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188565 91177308-0d34-0410-b5e6-96231b3b80d8
* Updating function comments; no functional changes intended.Aaron Ballman2013-08-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188554 91177308-0d34-0410-b5e6-96231b3b80d8
* sys::process::get_id() now returns the process ID instead of a process ↵Aaron Ballman2013-06-08
| | | | | | handle on Windows. Patch thanks to Kim Gräsman! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183621 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix an obvious typo spotted by Reid Kleckner, and breaking windows builds.Chandler Carruth2013-01-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171559 91177308-0d34-0410-b5e6-96231b3b80d8
* Add time getters to the process interface for requesting the elapsedChandler Carruth2013-01-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | wall time, user time, and system time since a process started. For walltime, we currently use TimeValue's interface and a global initializer to compute a close approximation of total process runtime. For user time, this adds support for an somewhat more precise timing mechanism -- clock_gettime with the CLOCK_PROCESS_CPUTIME_ID clock selected. For system time, we have to do a full getrusage call to extract the system time from the OS. This is expensive but unavoidable. In passing, clean up the implementation of the old APIs and fix some latent bugs in the Windows code. This might have manifested on Windows ARM systems or other systems with strange 64-bit integer behavior. The old API for this both user time and system time simultaneously from a single getrusage call. While this results in fewer system calls, it also results in a lower precision user time and if only user time is desired, it introduces a higher overhead. It may be worthwhile to switch some of the pass timers to not track system time and directly track user and wall time. The old API also tracked walltime in a confusing way -- it just set it to the current walltime rather than providing any measure of wall time since the process started the way buth user and system time are tracked. The new API is more consistent here. The plan is to eventually implement these methods for a *child* process by using the wait3(2) system call to populate an rusage struct representing the whole subprocess execution. That way, after waiting on a child process its stats will become accurate and cheap to query. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171551 91177308-0d34-0410-b5e6-96231b3b80d8
* Flesh out a page size accessor in the new API.Chandler Carruth2012-12-31
| | | | | | | | Implement the old API in terms of the new one. This simplifies the implementation on Windows which can now re-use the self_process's once initialization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171330 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove an unused function in the old Process interface.Chandler Carruth2012-12-31
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171327 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch this code to a more idiomatic double using namespace directive.Chandler Carruth2012-12-31
| | | | | | | | Fix a truly odd namespace qualifier that was flat out wrong in the process. The fully qualified namespace would have been llvm::sys::TimeValue, llvm::TimeValue makes no sense. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171292 91177308-0d34-0410-b5e6-96231b3b80d8
* Begin sketching out the process interface.Chandler Carruth2012-12-31
| | | | | | | | | | | | | | | | | | | | | | | The coding style used here is not LLVM's style because this is modeled after a Boost interface and thus done in the style of a candidate C++ standard library interface. I'll probably end up proposing it as a standard C++ library if it proves to be reasonably portable and useful. This is just the most basic parts of the interface -- getting the process ID out of it. However, it helps sketch out some of the boiler plate such as the base class, derived class, shared code, and static factory function. It also introduces a unittest so that I can incrementally ensure this stuff works. However, I've not even compiled this code for Windows yet. I'll try to fix any Windows fallout from the bots, and if I can't fix it I'll revert and get someone on Windows to help out. There isn't a lot more that is mandatory, so soon I'll switch to just stubbing out the Windows side and get Michael Spencer to help with implementation as he can test it directly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171289 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-03
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
* Try to unbreak the windows build.Benjamin Kramer2012-07-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160567 91177308-0d34-0410-b5e6-96231b3b80d8
* Process: Add sys::Process::FileDescriptorHasColors().Daniel Dunbar2012-07-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160557 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove tabs.Bill Wendling2012-07-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160476 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply 'Add reverseColor to raw_ostream'.Benjamin Kramer2012-04-16
| | | | | | | To be used in printing unprintable source in clang diagnostics. Patch by Seth Cantrell, with a minor fix for mingw by me. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154805 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r154800 which breaks windows builders.Argyrios Kyrtzidis2012-04-16
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154802 91177308-0d34-0410-b5e6-96231b3b80d8
* Add reverseColor to raw_ostream.Argyrios Kyrtzidis2012-04-16
| | | | | | | To be used in printing unprintable source in clang diagnostics. Patch by Seth Cantrell! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154800 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove SetWorkingDirectory from the Process interface. Nothing in LLVMChandler Carruth2012-01-15
| | | | | | | | | | | | or Clang is using this, and it would be hard to use it correctly given the thread hostility of the function. Also, it never checked the return which is rather dangerous with chdir. If someone was in fact using this, please let me know, as well as what the usecase actually is so that I can add it back and make it more correct and secure to use. (That said, it's never going to be "safe" per-se, but we could at least document the risks...) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148211 91177308-0d34-0410-b5e6-96231b3b80d8
* sys::Process: Add a SetWorkingDirectory method.Daniel Dunbar2011-09-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140433 91177308-0d34-0410-b5e6-96231b3b80d8
* Merge System into Support.Michael J. Spencer2010-11-29
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120298 91177308-0d34-0410-b5e6-96231b3b80d8