Permalink
Browse files

optimisation; profiling tools

  • Loading branch information...
1 parent 963875f commit 949bb681935870ee196b97897a15ac4f7ff0f766 Gianni Ciolli committed Nov 29, 2010
Showing with 202 additions and 114 deletions.
  1. +25 −0 debug_pgchess.sql
  2. +16 −16 libpg2podg.sql
  3. +108 −98 libpgchess.sql
  4. +25 −0 notice_pgchess.sql
  5. +25 −0 profiling_display.sql
  6. +3 −0 profiling_reset.sql
View
@@ -0,0 +1,25 @@
+--SET work_mem = 64;
+--SET temp_buffers = 100;
+SET synchronous_commit = off;
+SET client_min_messages = DEBUG;
+
+\i libpgchess.sql
+
+------------------------------------------------------------
+
+\pset format unaligned
+\pset tuples_only on
+\set VERBOSITY terse
+
+\qecho
+\qecho ------------------------------------------------------------
+\qecho -- (*) starting a new game
+\qecho ------------------------------------------------------------
+\qecho
+
+SELECT ui_reset();
+
+\o varfile1.sql
+SELECT another_move(1,1);
+\o
+\i varfile1.sql
View
@@ -113,9 +113,9 @@ BEGIN
ELSE
RAISE DEBUG '[%] The game is not yet settled, keep playing',procname;
END IF;
- RAISE DEBUG '[%] (1) reset available moves',procname;
+ RAISE NOTICE '[%] (1) reset available moves',procname;
TRUNCATE my_moves;
- RAISE DEBUG '[%] (2) insert all the possible next moves',procname;
+ RAISE NOTICE '[%] (2) insert all the possible next moves',procname;
INSERT INTO my_moves(current_game,this_move,move_level,score)
SELECT a.game
, a.move
@@ -124,9 +124,9 @@ BEGIN
FROM (
SELECT game, valid_moves(game) as move
FROM my_games) a;
- RAISE DEBUG '[%] (3) compute subsequent moves, up to level v_level',procname;
+ RAISE NOTICE '[%] (3) compute subsequent moves, up to level v_level',procname;
FOR v_l IN 1 .. v_level LOOP
- RAISE NOTICE '[%] level %',procname,v_l;
+ RAISE NOTICE '[%] (3.1) level %',procname,v_l;
v_j := 1;
v_n := 0;
FOR v_m IN
@@ -150,18 +150,18 @@ BEGIN
GET DIAGNOSTICS v_i = ROW_COUNT;
v_n := v_n + v_i;
RAISE NOTICE '[%] move % @ L% => % moves @ L%',procname,v_j,v_l,v_i,v_l+1;
- -- DEBUG block
- DECLARE
- v_r RECORD;
- BEGIN
- FOR v_r IN
- SELECT this_move FROM my_moves
- WHERE parent = v_m.id
- LOOP
- RAISE DEBUG '[%] move %',procname,v_r;
- END LOOP;
- END;
- -- END
+-- -- DEBUG block
+-- DECLARE
+-- v_r RECORD;
+-- BEGIN
+-- FOR v_r IN
+-- SELECT this_move FROM my_moves
+-- WHERE parent = v_m.id
+-- LOOP
+-- RAISE DEBUG '[%] move %',procname,v_r;
+-- END LOOP;
+-- END;
+-- -- END
/*
RAISE NOTICE 'game %, move %'
, CAST(v_m.id AS text)
Oops, something went wrong.

0 comments on commit 949bb68

Please sign in to comment.