Changeset 6398 for pymolproxy
- Timestamp:
- Jun 16, 2016 7:49:57 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pymolproxy/trunk/pymolproxy.c
r5963 r6398 623 623 ServerStats(int code) 624 624 { 625 double s tart, finish;625 double session_time; 626 626 char buf[BUFSIZ]; 627 627 Tcl_DString ds; 628 628 int result; 629 629 int f; 630 631 { 632 struct timeval tv; 633 634 /* Get ending time. */ 635 gettimeofday(&tv, NULL); 636 finish = CVT2SECS(tv); 637 tv = stats.start; 638 start = CVT2SECS(tv); 639 } 630 struct timeval now; 631 632 /* Get ending time. */ 633 gettimeofday(&now, NULL); 634 session_time = CVT2SECS(now) - CVT2SECS(stats.start); 635 640 636 /* 641 637 * Session information: … … 643 639 * - Process ID 644 640 * - Hostname where server is running 645 * - St artdate of session646 * - St artdate of session in seconds641 * - Stop date of session 642 * - Stop date of session in seconds 647 643 * - Number of frames returned 648 644 * - Number of bytes total returned (in frames) … … 674 670 /* date */ 675 671 Tcl_DStringAppendElement(&ds, "date"); 676 strcpy(buf, ctime(& stats.start.tv_sec));672 strcpy(buf, ctime(&now.tv_sec)); 677 673 buf[strlen(buf) - 1] = '\0'; 678 674 Tcl_DStringAppendElement(&ds, buf); 679 675 /* date_secs */ 680 676 Tcl_DStringAppendElement(&ds, "date_secs"); 681 sprintf(buf, "%ld", stats.start.tv_sec);677 sprintf(buf, "%ld", now.tv_sec); 682 678 Tcl_DStringAppendElement(&ds, buf); 683 679 /* num_frames */ … … 699 695 /* session_time */ 700 696 Tcl_DStringAppendElement(&ds, "session_time"); 701 sprintf(buf, "%g", finish - start);697 sprintf(buf, "%g", session_time); 702 698 Tcl_DStringAppendElement(&ds, buf); 703 699 /* status */ … … 927 923 char buf[BUFSIZ]; 928 924 static int first = 1; 929 int f ;925 int fd; 930 926 931 927 if (argc != 2) { … … 936 932 /* Use the initial client key value pairs as the parts for a generating 937 933 * a unique file name. */ 938 f = GetStatsFile(argv[1]);939 if (f < 0) {934 fd = GetStatsFile(argv[1]); 935 if (fd < 0) { 940 936 Tcl_AppendResult(interp, "can't open stats file: ", 941 937 Tcl_PosixError(interp), (char *)NULL); … … 958 954 buf[BUFSIZ-1] = '\0'; 959 955 Tcl_DStringAppendElement(&ds, buf); 956 /* date */ 957 Tcl_DStringAppendElement(&ds, "date"); 958 strcpy(buf, ctime(&stats.start.tv_sec)); 959 buf[strlen(buf) - 1] = '\0'; 960 Tcl_DStringAppendElement(&ds, buf); 961 /* date_secs */ 962 Tcl_DStringAppendElement(&ds, "date_secs"); 963 sprintf(buf, "%ld", stats.start.tv_sec); 964 Tcl_DStringAppendElement(&ds, buf); 960 965 } else { 966 struct timeval now; 961 967 Tcl_DStringAppendElement(&ds, "render_info"); 962 }963 /* date */964 Tcl_DStringAppendElement(&ds, "date");965 strcpy(buf, ctime(&stats.start.tv_sec));966 buf[strlen(buf) - 1] = '\0';967 Tcl_DStringAppendElement(&ds, buf);968 /* date_secs */969 Tcl_DStringAppendElement(&ds, "date_secs");970 sprintf(buf, "%ld", stats.start.tv_sec);971 Tcl_DStringAppendElement(&ds, buf);972 968 gettimeofday(&now, NULL); 969 /* date */ 970 Tcl_DStringAppendElement(&ds, "date"); 971 strcpy(buf, ctime(&now.tv_sec)); 972 buf[strlen(buf) - 1] = '\0'; 973 Tcl_DStringAppendElement(&ds, buf); 974 /* date_secs */ 975 Tcl_DStringAppendElement(&ds, "date_secs"); 976 sprintf(buf, "%ld", now.tv_sec); 977 Tcl_DStringAppendElement(&ds, buf); 978 } 973 979 /* Client arguments. */ 974 980 if (Tcl_SplitList(interp, argv[1], &numElems, &elems) != TCL_OK) { … … 980 986 free(elems); 981 987 Tcl_DStringAppend(&ds, "\n", 1); 982 result = WriteToStatsFile(f , Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));988 result = WriteToStatsFile(fd, Tcl_DStringValue(&ds), Tcl_DStringLength(&ds)); 983 989 Tcl_DStringFree(&ds); 984 990 return result;
Note: See TracChangeset
for help on using the changeset viewer.