| 41 | } |
| 42 | |
| 43 | void |
| 44 | TSPluginInit(int /* argc */, const char * /* argv */[]) |
| 45 | { |
| 46 | TSPluginRegistrationInfo info; |
| 47 | |
| 48 | info.plugin_name = PLUGIN_NAME; |
| 49 | info.vendor_name = "Apache Software Foundation"; |
| 50 | info.support_email = "dev@trafficserver.apache.org"; |
| 51 | |
| 52 | int id; |
| 53 | const char name[] = "plugin." PLUGIN_NAME ".now"; |
| 54 | |
| 55 | if (TSStatFindName(name, &id) == TS_ERROR) { |
| 56 | id = TSStatCreate(name, TS_RECORDDATATYPE_INT, TS_STAT_NON_PERSISTENT, TS_STAT_SYNC_SUM); |
| 57 | if (id == TS_ERROR) { |
| 58 | TSError("[%s] failed to register '%s'", PLUGIN_NAME, name); |
| 59 | return; |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | TSError("[%s] %s registered with id %d", PLUGIN_NAME, name, id); |
| 64 | |
| 65 | #if DEBUG |
| 66 | TSReleaseAssert(id != TS_ERROR); |
| 67 | #endif |
| 68 | |
| 69 | // Set an initial value for our statistic. |
| 70 | TSStatIntSet(id, time(nullptr)); |
| 71 | |
| 72 | // Increment the statistic as time passes. |
| 73 | TSStatIntIncrement(id, 1); |
| 74 | |
| 75 | Dbg(dbg_ctl, "%s is set to %" PRId64, name, TSStatIntGet(id)); |
| 76 | TSReleaseAssert(TSPluginRegister(&info) == TS_SUCCESS); |
| 77 | } |
nothing calls this directly
no test coverage detected