Summary:
Adds some basic building blocks to build hg using buck.
Header files are cleaned up, so they are relative to the project root.
Some minor changes to C code are made to remove clang build
warnings.
Rust dependencies, fb-hgext C/Python dependencies (ex. cstore,
mysql-connector), and 3rd-party dependencies like python-lz4
are not built yet. But the built hg binary should be able to run
most tests just fine.
Reviewed By: wez
Differential Revision: D6814686
fbshipit-source-id: 59eefd5a3ad86db2ad1c821ed824c9f1878c93e4
Summary:
On Windows `FILE*` seems to be different in traceprofimpl.cpp and Python:
```
# fp passed from traceprof.pyx:profile(fp=sys.stderr) to traceprofimpl.cpp
0x0000000000d23cc0 {_Placeholder=0x0000000000d23360 }
_Placeholder: 0x0000000000d23360
# stderr as seen from traceprofimpl.cpp natively
ucrtbase.dll!0x00007ffb29465510 (load symbols for additional information) {_Placeholder=0x0000000000000000 }
_Placeholder: 0x0000000000000000
```
Workaround that by enforcing output Windows to use stderr for now.
Test Plan:
```
C:\hg> python2 setup.py build_ext -i
...
C:\hg> type a.py
import sys
from mercurial import ui
from hgext import traceprof
def f(): g(1)
def g(x): print(x)
with traceprof.profile(ui.ui(), sys.stderr): f()
C:\hg> python2 a.py
1
| <module> a.py:1
| __exit__ C:\...\contextlib.py:21
Total time: 0 ms
```
Reviewers: #mercurial
Differential Revision: https://phabricator.intern.facebook.com/D6686958
Summary:
Get rid of `gettimeofday` and switch to C++11 `std::chrono` for Windows/rare
platform compatibility.
Also format the code using clang-format.
Test Plan:
Make sure it build on both x64 and Power8 platform.
`make local` and try it in IPython:
```
In [1]: from hgext import traceprof
In [2]: def f():
...: g(1)
...:
In [3]: def g(x):
...: print(x+1)
...:
In [4]: from mercurial import ui
In [7]: with traceprof.profile(ui.ui(), sys.stderr):
...: f()
...:
2
| <module> ipython2:3
| start_ipython IPython/__init__.py:93
| launch_instance application.py:650
| start ipapp.py:342
| mainloop interactiveshell.py:479
| interact interactiveshell.py:459
| run_cell interactiveshell.py:2591
| run_ast_nodes interactiveshell.py:2770
| run_code interactiveshell.py:2851
| <module> <ipython-input-7-2e5a012739d1>:1
| __exit__ contextlib.py:21
Total time: 0 ms
```
Note: it crashes on Windows, which will be workarounded in a later patch.
Reviewers: rmcelroy, #mercurial
Reviewed By: rmcelroy
Subscribers: fried
Differential Revision: https://phabricator.intern.facebook.com/D6681062
Tags: aarch64
Signature: 6681062:1515488414:6b7a51eda9e9764560d415350630590e4817fae2