Example #1
0
void XenonRequestLocalData::log(Xenon::SampleType t,
                                const char* info,
                                c_WaitableWaitHandle* wh) {
  if (!m_inRequest) return;

  TRACE(1, "XenonRequestLocalData::log\n");
  time_t now = time(nullptr);
  auto bt = createBacktrace(BacktraceArgs()
                             .skipTop(t == Xenon::EnterSample)
                             .skipInlined(t == Xenon::EnterSample)
                             .fromWaitHandle(wh)
                             .withMetadata()
                             .ignoreArgs());
  auto logDest = RuntimeOption::XenonStructLogDest;
  if (!logDest.empty()) {
    StructuredLogEntry cols;
    cols.setStr("type", Xenon::show(t));
    if (info) {
      cols.setStr("info", info);
    }
    addBacktraceToStructLog(bt, cols);
    StructuredLog::log(logDest, cols);
  } else {
    m_stackSnapshots.append(make_darray(
      s_time, now,
      s_stack, bt,
      s_isWait, !Xenon::isCPUTime(t),
      s_type, Xenon::show(t),
      s_info, info ? info : ""
    ));
  }
}
Example #2
0
/**
 * @brief Create a new trie
 *
 * @param   alpha_map   : the alphabet set for the trie
 *
 * @return a pointer to the newly created trie, NULL on failure
 *
 * Create a new empty trie object based on the given @a alpha_map alphabet
 * set. The trie contents can then be added and deleted with trie_store() and
 * trie_delete() respectively.
 *
 * The created object must be freed with trie_free().
 */
trie_t
make_trie(void)
{
	trie_t trie;

	if ((trie = (trie_t)malloc(sizeof(*trie))) == NULL) {
		return NULL;
	}

	if ((trie->da = make_darray()) == NULL) {
		goto exit_trie_created;
	}

	if ((trie->tail = make_tail()) == NULL) {
		goto exit_da_created;
	}
 
	trie->dirtyp = 1;
	return trie;

exit_da_created:
	free_darray(trie->da);
exit_trie_created:
	free(trie);
	return NULL;
}
Example #3
0
// Creates an array to respond to the Xenon PHP extension;
// builds the data into the format neeeded.
Array XenonRequestLocalData::createResponse() {
  assertx(m_inRequest);
  VArrayInit stacks(m_stackSnapshots.size());
  for (ArrayIter it(m_stackSnapshots); it; ++it) {
    const auto& frame = it.second().toArray();
    stacks.append(make_darray(
      s_time, frame[s_time],
      s_stack, frame[s_stack].toArray(),
      s_phpStack, parsePhpStack(frame[s_stack].toArray()),
      s_isWait, frame[s_isWait]
    ));
  }
  return stacks.toArray();
}