| 1667 | } |
| 1668 | |
| 1669 | void TracePluginImpl::log_event_func_execute(ITraceDatabaseConnection* connection, |
| 1670 | ITraceTransaction* transaction, ITraceFunction* function, bool started, |
| 1671 | ntrace_result_t func_result) |
| 1672 | { |
| 1673 | if (!config.log_function_start && started) |
| 1674 | return; |
| 1675 | |
| 1676 | if (!config.log_function_finish && !started) |
| 1677 | return; |
| 1678 | |
| 1679 | // Do not log operation if it is below time threshold |
| 1680 | const PerformanceInfo* info = started ? NULL : function->getPerf(); |
| 1681 | if (config.time_threshold && info && info->pin_time < config.time_threshold) |
| 1682 | return; |
| 1683 | |
| 1684 | ITraceParams* params = function->getInputs(); |
| 1685 | if (params && params->getCount()) |
| 1686 | { |
| 1687 | record.append(NEWLINE); |
| 1688 | appendParams(params); |
| 1689 | record.append(NEWLINE); |
| 1690 | } |
| 1691 | |
| 1692 | if (!started && func_result == ITracePlugin::RESULT_SUCCESS) |
| 1693 | { |
| 1694 | params = function->getResult(); |
| 1695 | { |
| 1696 | record.append("returns:" NEWLINE); |
| 1697 | appendParams(params); |
| 1698 | record.append(NEWLINE); |
| 1699 | } |
| 1700 | } |
| 1701 | |
| 1702 | if (info) |
| 1703 | { |
| 1704 | if (info->pin_records_fetched) |
| 1705 | { |
| 1706 | string temp; |
| 1707 | temp.printf("%" QUADFORMAT"d records fetched" NEWLINE, info->pin_records_fetched); |
| 1708 | record.append(temp); |
| 1709 | } |
| 1710 | appendGlobalCounts(info); |
| 1711 | appendTableCounts(info); |
| 1712 | } |
| 1713 | |
| 1714 | const char* event_type; |
| 1715 | switch (func_result) |
| 1716 | { |
| 1717 | case ITracePlugin::RESULT_SUCCESS: |
| 1718 | event_type = started ? "EXECUTE_FUNCTION_START" : |
| 1719 | "EXECUTE_FUNCTION_FINISH"; |
| 1720 | break; |
| 1721 | case ITracePlugin::RESULT_FAILED: |
| 1722 | event_type = started ? "FAILED EXECUTE_FUNCTION_START" : |
| 1723 | "FAILED EXECUTE_FUNCTION_FINISH"; |
| 1724 | break; |
| 1725 | case ITracePlugin::RESULT_UNAUTHORIZED: |
| 1726 | event_type = started ? "UNAUTHORIZED EXECUTE_FUNCTION_START" : |