summaryrefslogtreecommitdiff
path: root/include/llvm/Support/Process.h
Commit message (Collapse)AuthorAge
* 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 include guards so they exactly match file names.Jakub Staszak2013-01-10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172025 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
* Go ahead and get rid of the old page size interface and convert all theChandler Carruth2012-12-31
| | | | | | | users over to the new one. No sense maintaining this "compatibility" layer it seems. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171331 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
* 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
* Start sketching out a roadmap for better subprocess management in theChandler Carruth2012-12-31
| | | | | | | | | | | | | | | | | | | | | LLVM libraries. Also, clean up the doxygen and formatting of the existing interfaces. With this change I'm calling the existing interface "legacy" because I'd like to replace it with something much better. My end goal is to expose a common set of interfaces for inspecting various properties of a process, and implementations to expose those both for the current process and for child processes. This will also expose more rich interfaces for spawning and controling a subprocess, notably to use system calls like wait3 and wait4 where available and gather detailed resource usage stats about the subprocess. My plan (discussed with Michael Spencer on IRC) is to base this loosely around the proposed Boost.Process interface, but to implement a relatively small subset of that functionality based around the needs of LLVM, Clang, the Clang driver, etc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171285 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
* [Support] Add sys::Process::GetRandomNumber().Daniel Dunbar2012-05-05
| | | | | | - Primitive API, but we rarely have need for random numbers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156237 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
* Now to chant the magical incantation that will exorcise the System libraryCharles Davis2010-11-29
| | | | | | | | | from LLVM forever: grep -lR "llvm/System" * | grep -v .svn | xargs sed -ie 's#llvm/System#llvm/Support#g' git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120314 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