Profiler render - table
179039
protected function _profilerRenderChart()
    {
        ?>
        <div id="jbdump_profilter_chart_time" style="max-width: 1000px;margin:0 auto;text-align:left;"></div>
        <div id="jbdump_profilter_chart_memory" style="max-width: 1000px;margin:0 auto;text-align:left;"></div>
        <script type="text/javascript" src="https://www.google.com/jsapi"></script>
        <script type="text/javascript">
            google.load("visualization", "1", {packages: ["corechart"]});
            google.setOnLoadCallback(function drawChart() {
                //////////////////////////// time ////////////////////////////
                var data = new google.visualization.DataTable();
                data.addColumn('string', 'Label');
                data.addColumn('number', 'time, ms');
                data.addColumn('number', 'time delta, ms');
                data.addRows([
                    <?php
                    foreach ($this->_bufferInfo as $mark) {
                        echo '[\'' . $mark['label'] . '\', '
                                . self::_profilerFormatTime($mark['time']) . ', '
                                . self::_profilerFormatTime($mark['timeDiff']) . '],';
                    } ?>
                ]);

                var chart = new google.visualization.LineChart(document.getElementById('jbdump_profilter_chart_time'));
                chart.draw(data, {
                    'width' : 750,
                    'height': 400,
                    'title' : 'JBDump profiler by time'
                });

                //////////////////////////// memory ////////////////////////////
                var data = new google.visualization.DataTable();

                data.addColumn('string', 'Label');
                data.addColumn('number', 'memory, MB');
                data.addColumn('number', 'memory delta, MB');
                data.addRows([
                    <?php
                    foreach ($this->_bufferInfo as $mark) {
                        echo '[\'' . $mark['label'] . '\', '
                                . self::_profilerFormatMemory($mark['memory']) . ', '
                                . self::_profilerFormatMemory($mark['memoryDiff']) . '],';
                    } ?>
                ]);

                var chart = new google.visualization.LineChart(document.getElementById('jbdump_profilter_chart_memory'));
                chart.draw(data, {
                    'width' : 750,
                    'height': 400,
                    'title' : 'JBDump profiler by memory'
                });
            });
        </script>
    <?php
    }
425454
public static void profile( Performer performer , int num ) {

        long deltaTime = measureTime(performer,num);

        System.out.printf("%30s time = %8d ms per frame = %8.3f\n",
                performer.getName(),deltaTime,(deltaTime/(double)num));
//        System.out.println(performer.getClass().getSimpleName()+
//                " time = "+deltaTime+"  ms per frame "+(deltaTime/(double)num));
    }
340934
private void paintColumnHeadings(final WTable table, final WebXmlRenderContext renderContext) {
		XmlStringBuilder xml = renderContext.getWriter();
		int[] columnOrder = table.getColumnOrder();
		TableModel model = table.getTableModel();
		final int columnCount = columnOrder == null ? table.getColumnCount() : columnOrder.length;

		xml.appendTagOpen("ui:thead");
		xml.appendOptionalAttribute("hidden", !table.isShowColumnHeaders(), "true");
		xml.appendClose();

		for (int i = 0; i < columnCount; i++) {
			int colIndex = columnOrder == null ? i : columnOrder[i];
			WTableColumn col = table.getColumn(colIndex);

			if (col.isVisible()) {
				boolean sortable = model.isSortable(colIndex);
				paintColumnHeading(col, sortable, renderContext);
			}
		}

		xml.appendEndTag("ui:thead");
	}
1041071
public function renderProfile()
    {
        $this->checkIsLogin();

        $name = $this->di->get('session')->get("user");
        $user = $this->getUserDetails($name);


        $views = [
            ["comment/user/profile/profile", ["user" => $user], "main"]
        ];

        if ($user->authority == "admin") {
            $views = [
                ["comment/admin/navbar", [], "main"],
                ["comment/user/profile/profile", ["user" => $user], "main"]
            ];
        }

        $this->di->get("pageRenderComment")->renderPage([
            "views" =>  $views,
            "title" => "$user->name"
        ]);
    }
1277461
def get_profile(profile, caller, runner):
    '''
    
    '''
    profiles = profile.split(',')
    data = {}
    for profile in profiles:
        if os.path.basename(profile) == profile:
            profile = profile.split('.')[0]  # Trim extension if someone added it
            profile_path = os.path.join(os.path.dirname(__file__), 'profiles', profile + '.yml')
        else:
            profile_path = profile
        if os.path.exists(profile_path):
            try:
                rendered_template = _render_profile(profile_path, caller, runner)
                line = '-' * 80
                log.debug('\n%s\n%s\n%s\n', line, rendered_template, line)
                data.update(yaml.load(rendered_template))
            except Exception as ex:
                log.debug(ex, exc_info=True)
                raise salt.exceptions.SaltException('Rendering profile failed: {}'.format(ex))
        else:
            raise salt.exceptions.SaltException('Profile "{}" is not found.'.format(profile))

    return data
723050
def render_analyses_table(self, table="lab"):
        
        if table not in ["lab", "field", "qc"]:
            raise KeyError("Table '{}' does not exist".format(table))
        view_name = "table_{}_analyses".format(table)
        view = api.get_view(
            view_name, context=self.context, request=self.request)
        # Call listing hooks
        view.update()
        view.before_render()
        return view.ajax_contents_table()
442384
function (color, elem, prop, wrapper) {
                var renderer = this,
                  colorObject,
                  regexRgba = /^rgba/,
                  markup,
                  fillType,
                  ret = NONE;

                // Check for linear or radial gradient
                if (color && color.linearGradient) {
                    fillType = 'gradient';
                } else if (color && color.radialGradient) {
                    fillType = 'pattern';
                }


                if (fillType) {

                    var stopColor,
                      stopOpacity,
                      gradient = color.linearGradient || color.radialGradient,
                      x1,
                      y1,
                      x2,
                      y2,
                      opacity1,
                      opacity2,
                      color1,
                      color2,
                      fillAttr = '',
                      stops = color.stops,
                      firstStop,
                      lastStop,
                      colors = [],
                      addFillNode = function () {
                          // Add the fill subnode. When colors attribute is used, the meanings of opacity and o:opacity2
                          // are reversed.
                          markup = ['<fill colors="' + colors.join(',') + '" opacity="', opacity2, '" o:opacity2="', opacity1,
                              '" type="', fillType, '" ', fillAttr, 'focus="100%" method="any" />'];
                          createElement(renderer.prepVML(markup), null, null, elem);
                      };

                    // Extend from 0 to 1
                    firstStop = stops[0];
                    lastStop = stops[stops.length - 1];
                    if (firstStop[0] > 0) {
                        stops.unshift([
                            0,
                            firstStop[1]
                        ]);
                    }
                    if (lastStop[0] < 1) {
                        stops.push([
                            1,
                            lastStop[1]
                        ]);
                    }

                    // Compute the stops
                    each(stops, function (stop, i) {
                        if (regexRgba.test(stop[1])) {
                            colorObject = Color(stop[1]);
                            stopColor = colorObject.get('rgb');
                            stopOpacity = colorObject.get('a');
                        } else {
                            stopColor = stop[1];
                            stopOpacity = 1;
                        }

                        // Build the color attribute
                        colors.push((stop[0] * 100) + '% ' + stopColor);

                        // Only start and end opacities are allowed, so we use the first and the last
                        if (!i) {
                            opacity1 = stopOpacity;
                            color2 = stopColor;
                        } else {
                            opacity2 = stopOpacity;
                            color1 = stopColor;
                        }
                    });

                    // Apply the gradient to fills only.
                    if (prop === 'fill') {

                        // Handle linear gradient angle
                        if (fillType === 'gradient') {
                            x1 = gradient.x1 || gradient[0] || 0;
                            y1 = gradient.y1 || gradient[1] || 0;
                            x2 = gradient.x2 || gradient[2] || 0;
                            y2 = gradient.y2 || gradient[3] || 0;
                            fillAttr = 'angle="' + (90  - math.atan(
                                (y2 - y1) / // y vector
                                (x2 - x1) // x vector
                              ) * 180 / mathPI) + '"';

                            addFillNode();

                            // Radial (circular) gradient
                        } else {

                            var r = gradient.r,
                              sizex = r * 2,
                              sizey = r * 2,
                              cx = gradient.cx,
                              cy = gradient.cy,
                              radialReference = elem.radialReference,
                              bBox,
                              applyRadialGradient = function () {
                                  if (radialReference) {
                                      bBox = wrapper.getBBox();
                                      cx += (radialReference[0] - bBox.x) / bBox.width - 0.5;
                                      cy += (radialReference[1] - bBox.y) / bBox.height - 0.5;
                                      sizex *= radialReference[2] / bBox.width;
                                      sizey *= radialReference[2] / bBox.height;
                                  }
                                  fillAttr = 'src="' + defaultOptions.global.VMLRadialGradientURL + '" ' +
                                    'size="' + sizex + ',' + sizey + '" ' +
                                    'origin="0.5,0.5" ' +
                                    'position="' + cx + ',' + cy + '" ' +
                                    'color2="' + color2 + '" ';

                                  addFillNode();
                              };

                            // Apply radial gradient
                            if (wrapper.added) {
                                applyRadialGradient();
                            } else {
                                // We need to know the bounding box to get the size and position right
                                wrapper.onAdd = applyRadialGradient;
                            }

                            // The fill element's color attribute is broken in IE8 standards mode, so we
                            // need to set the parent shape's fillcolor attribute instead.
                            ret = color1;
                        }

                        // Gradients are not supported for VML stroke, return the first color. #722.
                    } else {
                        ret = stopColor;
                    }

                    // if the color is an rgba color, split it and add a fill node
                    // to hold the opacity component
                } else if (regexRgba.test(color) && elem.tagName !== 'IMG') {

                    colorObject = Color(color);

                    markup = ['<', prop, ' opacity="', colorObject.get('a'), '"/>'];
                    createElement(this.prepVML(markup), null, null, elem);

                    ret = colorObject.get('rgb');


                } else {
                    var propNodes = elem.getElementsByTagName(prop); // 'stroke' or 'fill' node
                    if (propNodes.length) {
                        propNodes[0].opacity = 1;
                        propNodes[0].type = 'solid';
                    }
                    ret = color;
                }

                return ret;
            }
1293631
protected function renderHeader()
    {
        $helper = Mage::helper('aoe_profiler'); /* @var $helper Aoe_Profiler_Helper_Data */

        $captions = '<ul>
            <li class="captions">
                <div class="info">';
        $captions .= '<div class="profiler-columns">';
        foreach ($this->metrics as $metric) {
            $captions .= '<div class="metric">';
            $captions .= '<div class="profiler-column3">';
            $captions .= $this->__($metric);
            $captions .= '</div>';
            $captions .= '</div>';
        }
        $captions .= '</div>';
        $captions .= '</div>
            </li>
        </ul>';

        $captions .= '<ul>
            <li class="captions captions-line">
                <div class="info">
                    <div class="profiler-label">' . $this->__('Name') . '
                        <a id="expand-all" href="#">[' . $this->__('expand all') . ']</a>
                        <a id="collapse-all" href="#">[' . $this->__('collapse all') . ']</a>
                    </div>';
        $captions .= '<div class="profiler-columns">';
        foreach ($this->metrics as $metric) {
            $formatterMethod = 'format_' . $metric;
            $captions .= '<div class="metric">';
            $captions .= '<div class="profiler-column3">';
            $captions .= $helper->$formatterMethod($this->stackLog['timetracker_0'][$metric . '_total']) . ' ' . $this->units[$metric];
            $captions .= '</div>';
            $captions .= '</div>';
        }
        $captions .= '</div>';
        $captions .= '</div>
            </li>
        </ul>';

        return $captions;
    }
1128006
private void paintRows(final WTable table, final WebXmlRenderContext renderContext) {
		XmlStringBuilder xml = renderContext.getWriter();
		TableModel model = table.getTableModel();

		xml.appendTagOpen("ui:tbody");
		xml.appendAttribute("id", table.getId() + ".body");
		xml.appendClose();

		if (model.getRowCount() == 0) {
			xml.appendTag("ui:nodata");
			xml.appendEscaped(table.getNoDataMessage());
			xml.appendEndTag("ui:nodata");
		} else {
			// If has at least one visible col, paint the rows.
			final int columnCount = table.getColumnCount();

			for (int i = 0; i < columnCount; i++) {
				if (table.getColumn(i).isVisible()) {
					doPaintRows(table, renderContext);
					break;
				}
			}
		}

		xml.appendEndTag("ui:tbody");
	}
1309814
def render_template(table_headers, table_items, **options):
    
    caption = options.get("caption") or "Table"
    display_length = options.get("display_length") or -1
    height = options.get("height") or "70vh"
    default_length_menu = [-1, 10, 25, 50]
    pagination = options.get("pagination")
    virtual_scroll_limit = options.get("virtual_scroll")

    # Change % to vh
    height = height.replace("%", "vh")

    # Header columns
    columns = []
    for header in table_headers:
        columns.append({"title": header})

    # Data table options
    datatable_options = {
        "columns": columns,
        "data": table_items,
        "iDisplayLength": display_length,
        "sScrollX": "100%",
        "sScrollXInner": "100%"
    }

    # Enable virtual scroll for rows bigger than 1000 rows
    is_paging = pagination
    virtual_scroll = False
    scroll_y = height

    if virtual_scroll_limit:
        if virtual_scroll_limit != -1 and len(table_items) > virtual_scroll_limit:
            virtual_scroll = True
            display_length = -1

        fmt = ("\nVirtual scroll is enabled since number of rows exceeds {limit}."
               " You can set custom row limit by setting flag -vs, --virtual-scroll."
               " Virtual scroll can be disabled by setting the value to -1 and set it to 0 to always enable.")
        logger.warn(fmt.format(limit=virtual_scroll_limit))

        if not is_paging:
            fmt = "\nPagination can not be disabled in virtual scroll mode."
            logger.warn(fmt)

        is_paging = True

    if is_paging and not virtual_scroll:
        # Add display length to the default display length menu
        length_menu = []
        if display_length != -1:
            length_menu = sorted(default_length_menu + [display_length])
        else:
            length_menu = default_length_menu

        # Set label as "All" it display length is -1
        length_menu_label = [str("All") if i == -1 else i for i in length_menu]
        datatable_options["lengthMenu"] = [length_menu, length_menu_label]
        datatable_options["iDisplayLength"] = display_length

    if is_paging:
        datatable_options["paging"] = True
    else:
        datatable_options["paging"] = False

    if scroll_y:
        datatable_options["scrollY"] = scroll_y

    if virtual_scroll:
        datatable_options["scroller"] = True
        datatable_options["bPaginate"] = False
        datatable_options["deferRender"] = True
        datatable_options["bLengthChange"] = False

    enable_export = options.get("export")
    if enable_export:
        if options["export_options"]:
            allowed = list(options["export_options"])
        else:
            allowed = ["copy", "csv", "json", "print"]

        datatable_options["dom"] = "Bfrtip"
        datatable_options["buttons"] = allowed

    datatable_options_json = json.dumps(datatable_options,
                                        separators=(",", ":"))

    return template.render(title=caption or "Table",
                           caption=caption,
                           datatable_options=datatable_options_json,
                           virtual_scroll=virtual_scroll,
                           enable_export=enable_export)
1031337
function Renderer(options) {
  var defaults = {
    headers: {
      included: true,
      downcase: true,
      upcase: true
    },

    delimiter: 'tab',
    decimalSign: 'comma',
    outputDataType: 'json',
    columnDelimiter: "\t",
    rowDelimiter: '\n',

    inputHeader: {},
    outputHeader: {},
    dataSelect: {},

    outputText: '',

    newline: '\n',
    indent: '  ',

    commentLine: '//',
    commentLineEnd: '',
    tableName: 'converter',

    useUnderscores: true,
    includeWhiteSpace: true,
    useTabsForIndent: false
  };

  this.options = merge({}, defaults, options);
  if (this.options.includeWhiteSpace) {
    this.options.newline = '\n';
  } else {
    this.options.indent = '';
    this.options.newline = '';
  }
}
971307
@Override
	public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
		WTableRowRenderer renderer = (WTableRowRenderer) component;
		XmlStringBuilder xml = renderContext.getWriter();
		WTable table = renderer.getTable();
		TableModel dataModel = table.getTableModel();

		int[] columnOrder = table.getColumnOrder();
		final int numCols = columnOrder == null ? table.getColumnCount() : columnOrder.length;

		// Get current row details
		RowIdWrapper wrapper = renderer.getCurrentRowIdWrapper();
		List<Integer> rowIndex = wrapper.getRowIndex();

		boolean tableSelectable = table.getSelectMode() != SelectMode.NONE;
		boolean rowSelectable = tableSelectable && dataModel.isSelectable(rowIndex);
		boolean rowSelected = rowSelectable && table.getSelectedRows().contains(wrapper.getRowKey());

		boolean tableExpandable = table.getExpandMode() != WTable.ExpandMode.NONE;
		boolean rowExpandable = tableExpandable && dataModel.isExpandable(rowIndex) && wrapper.
				hasChildren();
		boolean rowExpanded = rowExpandable && table.getExpandedRows().contains(wrapper.getRowKey());

		String rowIndexAsString = TableUtil.rowIndexListToString(rowIndex);

		xml.appendTagOpen("ui:tr");
		xml.appendAttribute("rowIndex", rowIndexAsString);
		xml.appendOptionalAttribute("unselectable", !rowSelectable, "true");
		xml.appendOptionalAttribute("selected", rowSelected, "true");
		xml.appendOptionalAttribute("expandable", rowExpandable && !rowExpanded, "true");
		xml.appendClose();

		// wrote the column cell.
		boolean isRowHeader = table.isRowHeaders(); // need this before we get into the loop
		for (int i = 0; i < numCols; i++) {
			int colIndex = columnOrder == null ? i : columnOrder[i];
			WTableColumn col = table.getColumn(colIndex);
			String cellTag = "ui:td";

			if (col.isVisible()) {
				if (isRowHeader) { // The first rendered column will be the row header.
					cellTag = "ui:th";
					isRowHeader = false; // only set one col as the row header.
				}
				xml.appendTag(cellTag);
				renderer.getRenderer(colIndex).paint(renderContext);
				xml.appendEndTag(cellTag);
			}
		}

		if (rowExpandable) {
			xml.appendTagOpen("ui:subtr");
			xml.appendOptionalAttribute("open", rowExpanded, "true");
			xml.appendClose();

			if (rowExpanded || table.getExpandMode() == ExpandMode.CLIENT) {
				renderChildren(renderer, renderContext, wrapper.getChildren());
			}

			xml.appendEndTag("ui:subtr");
		}

		xml.appendEndTag("ui:tr");
	}
170889
def define_log_renderer(fmt, fpath, quiet):
    
    # it must accept a logger, method_name and event_dict (just like processors)
    # but must return the rendered string, not a dictionary.
    # TODO tty logic

    if fmt:
        return structlog.processors.JSONRenderer()

    if fpath is not None:
        return structlog.processors.JSONRenderer()

    if sys.stderr.isatty() and not quiet:
        return structlog.dev.ConsoleRenderer()

    return structlog.processors.JSONRenderer()
464144
function tableFromMethods(methodsArr) {
  const headers = ["Method Name", "Type", "Parameters", "Description"]
  let rows = []

  // construct rows of table array of methods
  methodsArr.forEach((method) => {
    let cols = []

    cols.push(method["name"]) // method name
    let paramList = ''
    method["params"].forEach((param) => {
      paramList += `${param["name"]}: ${param["type"]["name"]} - ${param["description"]}\n`
    })
    cols.push(paramList) // list of method parameters
    cols.push(`${method["description"]}`) // description of the method

    rows.push(cols);
  })
  
  return rows.length > 0 ? {table: {headers, rows}} : null
}
299874
function Profiler(logger, name, level) {
  this.logger = logger;
  this.name = name;
  this.times = 0;
  this.diff = 0;
  this.paused = true;
  this.level = level || 'debug';
}
1174958
function getRenderedStats(rendered, compileOptions) {
  return {
    entryFilename: normalizePath(rendered.stats.entry),
    includedFiles: rendered.stats.includedFiles.map(f => normalizePath(makeAbsolute(f))),
    includedPaths: (compileOptions.includePaths || []).map(normalizePath),
  };
}
716609
function (outputName, renderer) {
        var outputInfo = this.outputs[outputName];
        var parameters = outputInfo.parameters;
        var parametersCopy = outputInfo._parametersCopy;
        if (!parametersCopy) {
            parametersCopy = outputInfo._parametersCopy = {};
        }
        if (parameters) {
            for (var key in parameters) {
                if (key !== 'width' && key !== 'height') {
                    parametersCopy[key] = parameters[key];
                }
            }
        }
        var width, height;
        if (typeof parameters.width === 'function') {
            width = parameters.width.call(this, renderer);
        }
        else {
            width = parameters.width;
        }
        if (typeof parameters.height === 'function') {
            height = parameters.height.call(this, renderer);
        }
        else {
            height = parameters.height;
        }
        width = Math.ceil(width);
        height = Math.ceil(height);
        if (
            parametersCopy.width !== width
            || parametersCopy.height !== height
        ) {
            if (this._outputTextures[outputName]) {
                this._outputTextures[outputName].dispose(renderer);
            }
        }
        parametersCopy.width = width;
        parametersCopy.height = height;

        return parametersCopy;
    }