2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-2014 Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
16 #ifndef TYPE_PROFILE_H_
17 #define TYPE_PROFILE_H_
19 #include "hphp/runtime/base/types.h"
20 #include "hphp/runtime/vm/hhbc.h"
26 struct TypeProfileKey
{
33 const StringData
* m_name
;
35 TypeProfileKey(KeyType kind
, const StringData
* sd
) :
36 m_kind(kind
), m_name(sd
) { }
38 TypeProfileKey(MemberCode mc
, const StringData
* sd
) :
39 m_kind(mc
== MET
? EltName
: PropName
), m_name(sd
) { }
40 uint64_t hash() const;
43 // These are both best-effort, and return noisy results.
45 void profileRequestStart();
46 void profileRequestEnd();
47 void recordType(TypeProfileKey sk
, DataType dt
);
48 std::pair
<DataType
, double> predictType(TypeProfileKey key
);
49 int64_t requestCount();
51 extern __thread
bool profileOn
;
52 inline bool shouldProfile() {
58 #endif // TYPE_PROFILE_H_