const size_t FeatureRegister::UNKNOWN_FEATURE_NUM = -1;
Feature *FeatureRegister::_features[FEATURES_MAX];
const char *FeatureRegister::_names[FEATURES_MAX];
+uint64_t FeatureRegister::_f0 = 0;
+uint64_t FeatureRegister::_f1 = 0;
FeatureRegister::FeatureRegister(Feature *feature, size_t num, const char *name)
{
_features[num] = feature;
_names[num] = name;
+
+ if (num < 64)
+ _f0 |= (uint64_t)1 << num;
+ else
+ _f1 |= (uint64_t)1 << (num - 64);
}
Feature *FeatureRegister::feature(size_t num)
static std::string featureName(size_t num);
static std::string featureName(const Feature *feature);
static size_t featureNum(const Feature *feature);
+ static uint64_t f0() { return _f0; }
+ static uint64_t f1() { return _f1; }
static const size_t UNKNOWN_FEATURE_NUM;
private:
+ static uint64_t _f0;
+ static uint64_t _f1;
static Feature *_features[FEATURES_MAX];
static const char *_names[FEATURES_MAX];
};
return 0;
}
+static uint64_t checkSupportFeatures(uint64_t f, uint64_t fs, size_t offset)
+{
+ if (f != fs) {
+ uint64_t diff = f ^ fs;
+
+ for (int i = 0; diff; diff >>= 1, ++i) {
+ if (diff & 1)
+ LOGW("feature[%d] is not support\n", i + offset);
+ }
+ }
+
+ return f & fs;
+}
+
extern "C" int fm_set(uint64_t f0, uint64_t f1)
{
- /* fill actual features (f0_support and f1_support) */
- const uint64_t f0_support = f0 & (FL_WEB_STARTUP_PROFILING |
- FL_APP_STARTUP
- );
- const uint64_t f1_support = f1 & (0);
- std::string f(u64toString(f1_support) + u64toString(f0_support));
+ const uint64_t fSupport0 = checkSupportFeatures(f0, FeatureRegister::f0(), 0);
+ const uint64_t fSupport1 = checkSupportFeatures(f1, FeatureRegister::f1(), 64);
+ const std::string f(u64toString(fSupport1) + u64toString(fSupport0));
if (fm->setFeatures(feature_bs(f)) != FeatureManager::Ok) {
LOGE("set features\n");
uint64_t to_enable = (new_features ^ old_features) & new_features;
uint64_t to_disable = (new_features ^ old_features) & old_features;
+ /* fill actual features fm suppor */
+ uint64_t fm_f0 = conf.use_features0
+ & (
+ FL_APP_STARTUP |
+ FL_WEB_STARTUP_PROFILING
+ );
+ uint64_t fm_f1 = conf.use_features1 & 0;
+
if (IS_OPT_SET_IN(FL_RECORDING, to_disable)) {
del_input_events();
prof_session.conf.use_features0 &= ~FL_RECORDING;
prof_session.conf.use_features0 |= FL_RECORDING;
}
- fm_set(conf.use_features0, conf.use_features1);
+ fm_set(fm_f0, fm_f1);
}
static void reconfigure_ld_probes(struct conf_t conf, struct msg_t **msg_reply, struct msg_t **msg_reply_additional)