aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar jcgregorio <jcgregorio@google.com>2014-06-06 06:30:31 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-06-06 06:30:31 -0700
commit659988168a1a86ecf9c01c07f8345671769a0ccc (patch)
treea1b9451a8629a7d7398ce84d94d65ceb889027bc
parenta494a91a1d5add5efb9a284b7ce05593b1391620 (diff)
Add metrics reporting to SkFiddle.
Also update the headers for template.cpp while we're here. BUG=skia: R=mtklein@google.com Author: jcgregorio@google.com Review URL: https://codereview.chromium.org/312373002
-rw-r--r--experimental/webtry/templates/template.cpp4
-rw-r--r--experimental/webtry/webtry.go16
2 files changed, 17 insertions, 3 deletions
diff --git a/experimental/webtry/templates/template.cpp b/experimental/webtry/templates/template.cpp
index 282475b0ff..6c5cfa80e9 100644
--- a/experimental/webtry/templates/template.cpp
+++ b/experimental/webtry/templates/template.cpp
@@ -18,6 +18,7 @@
#include "SkBlurDrawLooper.h"
#include "SkBlurImageFilter.h"
#include "SkBlurMaskFilter.h"
+#include "SkBlurTypes.h"
#include "SkCanvas.h"
#include "SkChecksum.h"
#include "SkChunkAlloc.h"
@@ -120,7 +121,6 @@
#include "SkRefCnt.h"
#include "SkRegion.h"
#include "SkRRect.h"
-#include "SkRTreePicture.h"
#include "SkScalar.h"
#include "SkShader.h"
#include "SkSize.h"
@@ -139,7 +139,6 @@
#include "SkTemplates.h"
#include "SkTestImageFilters.h"
#include "SkThread.h"
-#include "SkTileGridPicture.h"
#include "SkTileImageFilter.h"
#include "SkTime.h"
#include "SkTInternalLList.h"
@@ -151,6 +150,7 @@
#include "SkTypes.h"
#include "SkUnPreMultiply.h"
#include "SkUtils.h"
+#include "SkVertState.h"
#include "SkWeakRefCnt.h"
#include "SkWriteBuffer.h"
#include "SkWriter32.h"
diff --git a/experimental/webtry/webtry.go b/experimental/webtry/webtry.go
index 43598fe092..5c1443d6a2 100644
--- a/experimental/webtry/webtry.go
+++ b/experimental/webtry/webtry.go
@@ -17,6 +17,7 @@ import (
"io/ioutil"
"log"
"math/rand"
+ "net"
"net/http"
"os"
"os/exec"
@@ -31,11 +32,12 @@ import (
"github.com/fiorix/go-web/autogzip"
_ "github.com/go-sql-driver/mysql"
_ "github.com/mattn/go-sqlite3"
+ "github.com/rcrowley/go-metrics"
)
const (
RESULT_COMPILE = `../../experimental/webtry/safec++ -DSK_GAMMA_SRGB -DSK_GAMMA_APPLY_TO_A8 -DSK_SCALAR_TO_FLOAT_EXCLUDED -DSK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1 -DSK_SUPPORT_GPU=0 -DSK_SUPPORT_OPENCL=0 -DSK_FORCE_DISTANCEFIELD_FONTS=0 -DSK_SCALAR_IS_FLOAT -DSK_CAN_USE_FLOAT -DSK_SAMPLES_FOR_X -DSK_BUILD_FOR_UNIX -DSK_USE_POSIX_THREADS -DSK_SYSTEM_ZLIB=1 -DSK_DEBUG -DSK_DEVELOPER=1 -I../../src/core -I../../src/images -I../../tools/flags -I../../include/config -I../../include/core -I../../include/pathops -I../../include/pipe -I../../include/effects -I../../include/ports -I../../src/sfnt -I../../include/utils -I../../src/utils -I../../include/images -g -fno-exceptions -fstrict-aliasing -Wall -Wextra -Winit-self -Wpointer-arith -Wno-unused-parameter -m64 -fno-rtti -Wnon-virtual-dtor -c ../../../cache/%s.cpp -o ../../../cache/%s.o`
- LINK = `../../experimental/webtry/safec++ -m64 -lstdc++ -lm -o ../../../inout/%s -Wl,--start-group ../../../cache/%s.o obj/experimental/webtry/webtry.main.o obj/gyp/libflags.a libskia_images.a libskia_core.a libskia_effects.a obj/gyp/libjpeg.a obj/gyp/libetc1.a obj/gyp/libwebp_dec.a obj/gyp/libwebp_demux.a obj/gyp/libwebp_dsp.a obj/gyp/libwebp_enc.a obj/gyp/libwebp_utils.a libskia_utils.a libskia_opts.a libskia_opts_ssse3.a libskia_ports.a libskia_sfnt.a -Wl,--end-group -lpng -lz -lgif -lpthread -lfontconfig -ldl -lfreetype`
+ LINK = `../../experimental/webtry/safec++ -m64 -lstdc++ -lm -o ../../../inout/%s -Wl,--start-group ../../../cache/%s.o obj/experimental/webtry/webtry.main.o obj/gyp/libflags.a libskia_images.a libskia_core.a libskia_effects.a obj/gyp/libjpeg.a obj/gyp/libetc1.a obj/gyp/libSkKTX.a obj/gyp/libwebp_dec.a obj/gyp/libwebp_demux.a obj/gyp/libwebp_dsp.a obj/gyp/libwebp_enc.a obj/gyp/libwebp_utils.a libskia_utils.a libskia_opts.a libskia_opts_ssse3.a libskia_ports.a libskia_sfnt.a -Wl,--end-group -lpng -lz -lgif -lpthread -lfontconfig -ldl -lfreetype`
DEFAULT_SAMPLE = `void draw(SkCanvas* canvas) {
SkPaint p;
@@ -112,6 +114,8 @@ var (
gitHash = ""
gitInfo = ""
+
+ requestsCounter = metrics.NewRegisteredCounter("requests", metrics.DefaultRegistry)
)
// flags
@@ -280,6 +284,15 @@ func init() {
}
}()
+ metrics.RegisterRuntimeMemStats(metrics.DefaultRegistry)
+ go metrics.CaptureRuntimeMemStats(metrics.DefaultRegistry, 1*time.Minute)
+
+ // Start reporting metrics.
+ // TODO(jcgregorio) We need a centrialized config server for storing things
+ // like the IP address of the Graphite monitor.
+ addr, _ := net.ResolveTCPAddr("tcp", "10.240.159.195:2003")
+ go metrics.Graphite(metrics.DefaultRegistry, 1*time.Minute, "webtry", addr)
+
writeOutAllSourceImages()
}
@@ -733,6 +746,7 @@ func cleanCompileOutput(s, hash string) string {
// mainHandler handles the GET and POST of the main page.
func mainHandler(w http.ResponseWriter, r *http.Request) {
log.Printf("Main Handler: %q\n", r.URL.Path)
+ requestsCounter.Inc(1)
if r.Method == "GET" {
code := DEFAULT_SAMPLE
source := 0