Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

cmd_profile.C

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr
00003  *cr            (C) Copyright 1995-2019 The Board of Trustees of the
00004  *cr                        University of Illinois
00005  *cr                         All Rights Reserved
00006  *cr
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: cmd_profile.C,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.6 $       $Date: 2020/05/22 03:45:01 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  *   text commands for profiling CPU/GPU hardware performance
00019  ***************************************************************************/
00020 
00021 #include <tcl.h>
00022 #include <ctype.h>
00023 #include <stdio.h>
00024 #include <stdlib.h>
00025 #include <string.h>
00026 #include "Benchmark.h"
00027 #include "config.h"
00028 #include "VMDApp.h"
00029 #include "TclCommands.h"
00030 #include "CUDAKernels.h"
00031 #include "CUDAAccel.h"
00032 #include "WKFThreads.h"
00033 #include "ProfileHooks.h"
00034 
00035 static void cmd_profile_usage(Tcl_Interp *interp) {
00036   Tcl_AppendResult(interp,
00037       "usage: profile <command> [args...]\n"
00038       "profile start\n",
00039       "profile stop\n",
00040       "profile push_range <tag string>\n",
00041       "profile pop_range\n",
00042       "(*) Only available in CUDA-enabled builds of VMD\n",
00043       NULL);
00044 }
00045 
00046 int text_cmd_profile(ClientData cd, Tcl_Interp *interp, int argc, const char *argv[]) {
00047 #if 0 && defined(VMDCUDA) && defined(VMDNVTX)
00048   VMDApp *app = (VMDApp *)cd; // need VMDApp ptr GPU threadpool access
00049 #endif
00050 
00051   if (argc == 1) {
00052     cmd_profile_usage(interp);
00053     return TCL_ERROR;
00054   }
00055 
00056   if (argc >= 2) {
00057 #if !(defined(VMDCUDA) && defined(VMDNVTX))
00058     Tcl_AppendResult(interp, "CUDA Acceleration not available in this build", NULL);
00059     return TCL_ERROR;
00060 #else
00061     if (!strupncmp(argv[1], "start", CMDLEN)) {
00062       PROFILE_START();
00063       Tcl_AppendResult(interp, "Starting profiling", NULL);
00064       return TCL_OK;
00065     } else if (!strupncmp(argv[1], "stop", CMDLEN)) {
00066       PROFILE_STOP();
00067       Tcl_AppendResult(interp, "Stopping profiling", NULL);
00068       return TCL_OK;
00069     } else if (!strupncmp(argv[1], "push_range", CMDLEN)) {
00070       if (argc >= 3) {
00071         PROFILE_PUSH_RANGE(argv[2], 2);
00072       }
00073       return TCL_OK;
00074     } else if (!strupncmp(argv[1], "pop_range", CMDLEN)) {
00075       PROFILE_POP_RANGE();
00076       return TCL_OK;
00077     } else {
00078       cmd_profile_usage(interp);
00079       return TCL_ERROR;
00080     }
00081 #endif
00082   } else {
00083     cmd_profile_usage(interp);
00084     return TCL_ERROR;
00085   }
00086   
00087   // if here, everything worked out ok
00088   return TCL_OK;
00089 }
00090 
00091 

Generated on Wed Dec 4 02:43:03 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002