source: tools/SendToDim/SendCMD.cc@ 4507

Last change on this file since 4507 was 223, checked in by ogrimm, 15 years ago
Added command line utilities for DIM command and RPC
File size: 700 bytes
Line 
1//
2// Command-line utility to send a DIM command
3//
4//
5
6#include <stdio.h>
7#include <ctype.h>
8#include <sys/time.h>
9
10#include "dic.hxx"
11
12// Get configuration data
13int main(int argc, const char* argv[]) {
14
15 struct timeval Start, End;
16
17 if (argc != 3) {
18 printf("Usage: %s <Command Name> <ASCII Data>\n", argv[0]);
19 exit(EXIT_FAILURE);
20 }
21
22 // Send command
23 gettimeofday(&Start, NULL);
24 int Result = DimClient::sendCommand(argv[1], argv[2]);
25 gettimeofday(&End, NULL);
26
27 // Calculate time to completion
28 double Diff = (End.tv_sec-Start.tv_sec)*1e6 + End.tv_usec-Start.tv_usec;
29
30 printf("Command %s, execution time %.2f ms\n",
31 Result==1 ? "delivered" : "not delivered", Diff/1000);
32}
Note: See TracBrowser for help on using the repository browser.