获取当前实例的详细信息

@return dump output
546813
@Override
    public String dump() {
        final StringBuilder builder = new StringBuilder();
        if (mExecutor instanceof ThreadPoolExecutor) {
            // thread pool info
            final ThreadPoolExecutor executor = (ThreadPoolExecutor) mExecutor;
            final int corePoolSize = executor.getCorePoolSize();
            final int poolSize = executor.getPoolSize();
            final int activeCount = executor.getActiveCount();
            final long taskCount = executor.getTaskCount();
            final long completedCount = executor.getCompletedTaskCount();
            final boolean isShutdown = executor.isShutdown();
            final boolean isTerminated = executor.isTerminated();
            builder.append(TAG).append("[ ");
            builder.append("ThreadPool:{")
                    .append(" coreSize:").append(corePoolSize).append(";")
                    .append(" poolSize:").append(poolSize).append(";")
                    .append(" isShutdown:").append(isShutdown).append(";")
                    .append(" isTerminated:").append(isTerminated).append(";")
                    .append(" activeCount:").append(activeCount).append(";")
                    .append(" taskCount:").append(taskCount).append(";")
                    .append(" completedCount:").append(completedCount).append(";")
                    .append("}\n");
        } else {
            // thread pool info
            final ExecutorService executor = mExecutor;
            final boolean isShutdown = executor.isShutdown();
            final boolean isTerminated = executor.isTerminated();
            builder.append(TAG).append("[ ");
            builder.append("ThreadPool:{")
                    .append(" isShutdown:").append(isShutdown).append(";")
                    .append(" isTerminated:").append(isTerminated).append(";")
                    .append("}\n");
        }
        // group map
        final Map<String, List<String>> callerMap = mGroups;
        builder.append("Groups:{");
        for (Map.Entry<String, List<String>> entry : callerMap.entrySet()) {
            builder.append(" group:").append(entry.getKey())
                    .append(", tags:").append(ThreadUtils.toString(entry.getValue())).append(";");
        }
        builder.append("}\n");
        builder.append("]");

        // task map
        Map<String, ITaskRunnable> taskMap = mTasks;
        builder.append("Tasks:{");
        for (Map.Entry<String, ITaskRunnable> entry : taskMap.entrySet()) {
            builder.append(" tag:").append(entry.getKey())
                    .append(", runnable:").append(entry.getValue()).append(";");
        }
        builder.append("}\n");

        final String info = builder.toString();
        Log.v(TAG, info);
        return info;
    }
1122645
public ReturnCode dump() {
        System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverDumping"), serverName));

        Set<JavaDumpAction> javaDumpActions = new LinkedHashSet<JavaDumpAction>();
        parseJavaDumpInclude(javaDumpActions);

        ServerDumpPackager sdp = new ServerDumpPackager(bootProps, launchArgs.getOption(BootstrapConstants.CLI_ARG_ARCHIVE_TARGET));
        sdp.initializeDumpDirectory();

        ReturnCode dumpRc = createDumps(javaDumpActions, true, sdp.getDumpTimestamp());

        boolean serverInactiveStatusFlag = dumpRc == ReturnCode.SERVER_INACTIVE_STATUS;
        boolean serverUnknownStatusFlag = dumpRc == ReturnCode.SERVER_UNKNOWN_STATUS;
        boolean serverCommandPortDisabledFlag = dumpRc == ReturnCode.SERVER_COMMAND_PORT_DISABLED_STATUS;

        if (dumpRc == ReturnCode.OK) {
            File dumpedFlag = new File(sdp.getDumpDir(), BootstrapConstants.SERVER_DUMPED_FLAG_FILE_NAME);
            if (!dumpedFlag.exists()) {
                dumpRc = ReturnCode.ERROR_SERVER_DUMP;
            }
        }

        // already dumped, then zip up. Dump zip must be created in the output directory
        if (dumpRc == ReturnCode.OK || dumpRc == ReturnCode.SERVER_INACTIVE_STATUS || dumpRc == ReturnCode.SERVER_UNKNOWN_STATUS
            || dumpRc == ReturnCode.SERVER_COMMAND_PORT_DISABLED_STATUS) {

            if (javaDumpActions != null && (!!!javaDumpActions.isEmpty())) {
                dumpRc = sdp.packageDump(true);
            } else {
                dumpRc = sdp.packageDump(false);
            }
        }

        sdp.cleanupDumpDirectory();

        if (dumpRc == ReturnCode.OK) {
            if (serverInactiveStatusFlag) {
                // We are dumping a stopped server. Since it is not a problem, just print a message.
                System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverNotRunning"), serverName));
            }
            if (serverUnknownStatusFlag) {
                // We tried to attach to the server process, but that failed.
                // Since it might indicate an error, print a message and change the return code though the dump archive has been generated successfully.
                System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverStatusException"), serverName));
                dumpRc = ReturnCode.SERVER_UNKNOWN_STATUS;
            }
            if (serverCommandPortDisabledFlag) {
                System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("warning.serverDumpCompleteCommandPortDisabled"), serverName,
                                                        sdp.getDumpFile().getAbsolutePath()));
            } else {
                System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverDumpComplete"), serverName, sdp.getDumpFile().getAbsolutePath()));
            }
        } else {
            System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("info.serverDumpException"), serverName));
        }

        return dumpRc;
    }
6113
public function dump() {
		$prev = null;
		$s = '';
		for ( $node = $this->head; $node; $prev = $node, $node = $node->nextAFE ) {
			if ( $node instanceof Marker ) {
				$s .= "MARKER\n";
				continue;
			}
			$s .= $node->getDebugTag();
			if ( $node->nextNoah ) {
				$s .= " (noah sibling: " . $node->nextNoah->getDebugTag() .
					')';
			}
			if ( $node->nextAFE && $node->nextAFE->prevAFE !== $node ) {
				$s .= " (reverse link is wrong!)";
			}
			$s .= "\n";
		}
		if ( $prev !== $this->tail ) {
			$s .= "(tail pointer is wrong!)\n";
		}
		return $s;
	}
407818
private function showTrace() {
         // 系统默认显示信息
        $files =  get_included_files();
        $info   =   array();
        foreach ($files as $key=>$file){
            $info[] = $file.' ( '.number_format(filesize($file)/1024,2).' KB )';
        }
        $trace  =   array();
        $base   =   array(
            '请求信息'=>  date('Y-m-d H:i:s',$_SERVER['REQUEST_TIME']).' '.$_SERVER['SERVER_PROTOCOL'].' '.$_SERVER['REQUEST_METHOD'].' : '.__SELF__,
            '运行时间'=> $this->showTime(),
            '内存开销'=> MEMORY_LIMIT_ON?number_format((memory_get_usage() - $GLOBALS['_startUseMems'])/1024,2).' kb':'不支持',
            '查询信息'=> N('db_query').' queries '.N('db_write').' writes ',
            '文件加载'=> count(get_included_files()),
            '缓存信息'=> N('cache_read').' gets '.N('cache_write').' writes ',
            '配置加载'=> count(c()),
            '会话信息'=> 'SESSION_ID='.session_id(),
            );
        // 读取应用定义的Trace文件
        $traceFile  =   CONF_PATH.'trace.php';
        if(is_file($traceFile)) {
            $base    =   array_merge($base,include $traceFile);
        }
        $debug  =   trace();
        $tabs   =   C('TRACE_PAGE_TABS',null,$this->tracePagTabs);
        foreach ($tabs as $name=>$title){
            switch(strtoupper($name)) {
                case 'BASE':// 基本信息
                    $trace[$title]  =   $base;
                    break;
                case 'FILE': // 文件信息
                    $trace[$title]  =   $info;
                    break;
                default:// 调试信息
                    if(strpos($name,'|')) {// 多组信息
                        $array  =   explode('|',$name);
                        $result =   array();
                        foreach($array as $name){
                            $result   +=   isset($debug[$name])?$debug[$name]:array();
                        }
                        $trace[$title]  =   $result;
                    }else{
                        $trace[$title]  =   isset($debug[$name])?$debug[$name]:'';
                    }
            }
        }
    foreach ($trace as $key=>$val){
            if(!is_array($val) && empty($val))
                $val=array();
            if(is_array($val)){
            $fire=array(
            array('','')
            );
            foreach($val as $k=>$v){
                $fire[]=array($k,$v);
            }
            fb(array($key,$fire),FirePHP::TABLE);
        }else{
            fb($val,$key);
        }
     }
    unset($files,$info,$log,$base);
    }
265181
public byte[] getOutput() {
		if (stringWriter != null) {
			byte[] output = null;

			String string = stringWriter.toString();
			if (string != null) {
				try {
					output = string.getBytes(characterEncoding);
				} catch (UnsupportedEncodingException uue) {
					output = null;
				}
			}

			return output;
		} else if (outputStream != null) {
			return outputStream.getOutput();
		}

		return null;
	}
909951
public function _DumpString()
    {
        $cid = \Swoole\Coroutine::getuid();
        $ret="==== SwooleCoroutineSingleton List Current cid [{$cid}] ==== ;\n";
        foreach (self::$_instances as $cid=>$v) {
            foreach ($v as $cid_class=>$object) {
                $hash=$object?md5(spl_object_hash($object)):'';
                $class=$object?get_class($object):'';
                $class=$cid_class===$class?'':$class;
                $ret.="[$hash]$cid $cid_class($class)\n";
            }
        }
        return "{{$ret}}\n";
    }
1296230
public StringBuffer dumpAll() {
		WComponent root = WebUtilities.getTop(this);

		Map<String, GroupData> compTallyByClass = new TreeMap<>();

		GroupData compDataOverall = new GroupData();

		StringBuffer out = new StringBuffer();

		String className = root.getClass().getName();

		out.append("<strong>The root of the WComponent tree is:</strong><br/>").append(className).append(
				"<br/>");

		tally(root, compTallyByClass, compDataOverall, out);

		out.append("<strong>WComponent usage overall:</strong><br/> ");
		out.append(compDataOverall.total).append(" WComponent(s) in the WComponent tree.<br/>");

		if (compDataOverall.total > 0) {
			out.append("<strong>WComponent usage by class:</strong><br/>");

			for (Map.Entry<String, GroupData> entry : compTallyByClass.entrySet()) {
				className = entry.getKey();
				GroupData dataForClass = entry.getValue();
				out.append(' ').append(dataForClass.total).append("  ").append(className).append(
						"<br/>");
			}

			out.append("<br/><hr/>");
		}

		processUic(out);

		return out;
	}
451739
public void dumpOut(){
		System.out.println(this.toString());
		TraceStep root = getRootStep();
		dumpOut(root, 1);
	}
297224
public function dump()
        {
            $objects = func_get_args();
            $content = "\n<pre>\n";

            foreach($objects as $object) {
                $content .= print_r($object, true);
            }

            return $content . "\n</pre>\n";
        }
930510
final public function output (){

        if($this->_outputOnlyHeaders){
            $this->sendHttpHeaders();
            return true;
        }
    
        $this->_httpHeaders['Content-Type'] =
                'application/atom+xml;charset=' . $this->charset;

        if(!$this->infos->updated){
            $this->infos->updated = date("Y-m-d H:i:s");
        }

        // generate the main content, in a buffer
        // so we can handle errors
        $this->_template->assign ('atom', $this->infos);
        $this->_template->assign ('items', $this->itemList);
        $this->_template->assign ('lang',$this->lang);
        $content = $this->_template->fetch ($this->_mainTpl);

        $this->sendHttpHeaders();
        echo '<?xml version="1.0" encoding="'. $this->charset .'"?>', "\n";
        $this->_outputXmlHeader ();
        echo $content;
        return true;
    }
506544
public String dump()
   {
      StringBuilder vals = new StringBuilder("Property ");
      try
      {
         vals = new StringBuilder(getPath()).append(" values: ");
         for (int i = 0; i < getValueArray().length; i++)
         {
            vals.append(ValueDataUtil.getString(((BaseValue)getValueArray()[i]).getInternalData())).append(";");
         }
      }
      catch (Exception e)
      {
         LOG.error(e.getLocalizedMessage(), e);
      }
      return vals.toString();
   }
1094161
protected function dump() {
    $str = '';
    foreach (array_values($this->loadedObjects) as $curObject) {
      $str .= $curObject->dump();
    }
    return $str;
  }
1040582
public function dumpTokens() {
		$result = "";
		foreach ($this->tokens as $token) {
			$result .= $token->toString() . PHP_EOL;
		}
		return $result;
	}
772763
public function getData() {
		if ($this->_tempFileName == '') {
			return $this->_xmlWriter->outputMemory(true);
		} else {
			$this->_xmlWriter->flush();
			return file_get_contents($this->_tempFileName);
		}
	}
96602
@GET
    @Path("stack")
    @Produces(MediaType.TEXT_PLAIN)
    public String getThreadDump() {
        if (LOG.isDebugEnabled()) {
            LOG.debug("==> AdminResource.getThreadDump()");
        }

        ThreadGroup topThreadGroup = Thread.currentThread().getThreadGroup();

        while (topThreadGroup.getParent() != null) {
            topThreadGroup = topThreadGroup.getParent();
        }
        Thread[] threads = new Thread[topThreadGroup.activeCount()];

        int nr = topThreadGroup.enumerate(threads);
        StringBuilder builder = new StringBuilder();
        for (int i = 0; i < nr; i++) {
            builder.append(threads[i].getName()).append("\nState: ").
                    append(threads[i].getState()).append("\n");
            String stackTrace = StringUtils.join(threads[i].getStackTrace(), "\n");
            builder.append(stackTrace);
        }

        if (LOG.isDebugEnabled()) {
            LOG.debug("<== AdminResource.getThreadDump()");
        }

        return builder.toString();
    }
1338697
public function getContent() {
        $cmd = Factory::config('php_path', 'php').' -dvld.active=1 '.$this->srcFile;  // 替换为你要执行的shell脚本
        $process = Process::factory($cmd);
        $status = $process->start()->join()->stop();
        extract($process->getOutput());
        return $stderr;
    }
824625
public function getinfo()
    {
        error_reporting(0);    //会有多处报错，因此这里进行屏蔽
        switch (PHP_OS) {// 根据不同系统取得CPU相关信息
            case "Linux":
                $sysInfo = self::sys_linux();
                break;
            case "FreeBSD":
                $sysInfo = self::sys_freebsd();
                break;
            default:
                $sysInfo = [];
                break;
        }
        $result = $sysInfo;
        $result['freeSpace'] = round(@disk_free_space(".") / (1024 * 1024 * 1024), 3);
        $result['diskTotal'] = round(@disk_total_space(".") / (1024 * 1024 * 1024), 3);    //总空间
        //网卡流量
        $strs = @file("/proc/net/dev");
        $NetOut = array();
        for ($i = 2; $i < count($strs); $i++) {
            preg_match_all("/([^\s]+):[\s]{0,}(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/", $strs[$i], $info);
            /*	$NetInput[$i] = formatsize($info[2][0]);
                $NetOut[$i]  = formatsize($info[10][0]);
            */
            $tmo = round($info[2][0] / 1024 / 1024, 5);
            $tmo2 = round($tmo / 1024, 5);
            $NetInput[$i] = $tmo2;
            $tmp = round($info[10][0] / 1024 / 1024, 5);
            $tmp2 = round($tmp / 1024, 5);
            $NetOut[$i] = $tmp2;
        }
        //判断内存如果小于1GB，就显示M，否则显示GB单位
        if ($sysInfo['memTotal'] < 1024) {
            $result['TotalMemory'] = $sysInfo['memTotal'] . " MB";
            $result['UsedMemory'] = $sysInfo['memUsed'] . " MB";
            $result['FreeMemory'] = $sysInfo['memFree'] . " MB";
            $result['CachedMemory'] = $sysInfo['memCached'] . " MB";    //cache化内存
            $result['Buffers'] = $sysInfo['memBuffers'] . " MB";    //缓冲
            $result['TotalSwap'] = $sysInfo['swapTotal'] . " MB";
            $result['swapUsed'] = $sysInfo['swapUsed'] . " MB";
            $result['swapFree'] = $sysInfo['swapFree'] . " MB";
            $result['swapPercent'] = $sysInfo['swapPercent'];
            $result['memRealUsed'] = $sysInfo['memRealUsed'] . " MB"; //真实内存使用
            $result['memRealFree'] = $sysInfo['memRealFree'] . " MB"; //真实内存空闲
            $result['memRealPercent'] = $sysInfo['memRealPercent']; //真实内存使用比率
            $result['memPercent'] = $sysInfo['memPercent'] . '%'; //内存总使用率
            $result['memCachedPercent'] = $sysInfo['memCachedPercent']; //cache内存使用率
        } else {
            $result['TotalMemory'] = round($sysInfo['memTotal'] / 1024, 3) . " GB";
            $result['UsedMemory'] = round($sysInfo['memUsed'] / 1024, 3) . " GB";
            $result['FreeMemory'] = round($sysInfo['memFree'] / 1024, 3) . " GB";
            $result['CachedMemory'] = round($sysInfo['memCached'] / 1024, 3) . " GB";
            $result['Buffers'] = round($sysInfo['memBuffers'] / 1024, 3) . " GB";
            $result['TotalSwap'] = round($sysInfo['swapTotal'] / 1024, 3) . " GB";
            $result['swapUsed'] = round($sysInfo['swapUsed'] / 1024, 3) . " GB";
            $result['swapFree'] = round($sysInfo['swapFree'] / 1024, 3) . " GB";
            $result['swapPercent'] = $sysInfo['swapPercent'];
            $result['memRealUsed'] = round($sysInfo['memRealUsed'] / 1024, 3) . " GB"; //真实内存使用
            $result['memRealFree'] = round($sysInfo['memRealFree'] / 1024, 3) . " GB"; //真实内存空闲
            $result['memRealPercent'] = $sysInfo['memRealPercent']; //真实内存使用比率
            $result['memPercent'] = $sysInfo['memPercent'] . '%'; //内存总使用率
            $result['memCachedPercent'] = $sysInfo['memCachedPercent']; //cache内存使用率
        }
        $result['barmemCachedPercent'] = $result['memCachedPercent'] . '%';
        $result['barswapPercent'] = $result['swapPercent'] . '%';
        $result['barmemRealPercent'] = $result['memRealPercent'] . '%';
        $result['NetOut2'] = $NetOut[2];
        $result['NetOut3'] = $NetOut[3];
        $result['NetOut4'] = $NetOut[4];
        $result['NetOut5'] = $NetOut[5];
        $result['NetOut6'] = $NetOut[6];
        $result['NetOut7'] = $NetOut[7];
        $result['NetOut8'] = $NetOut[8];
        $result['NetOut9'] = $NetOut[9];
        $result['NetOut10'] = $NetOut[10];
        $result['NetInput2'] = $NetInput[2];
        $result['NetInput3'] = $NetInput[3];
        $result['NetInput4'] = $NetInput[4];
        $result['NetInput5'] = $NetInput[5];
        $result['NetInput6'] = $NetInput[6];
        $result['NetInput7'] = $NetInput[7];
        $result['NetInput8'] = $NetInput[8];
        $result['NetInput9'] = $NetInput[9];
        $result['NetInput10'] = $NetInput[10];

        return $result;
    }