Mercurial > emacs
annotate lisp/cedet/semantic/chart.el @ 104463:e4788b39543d
lisp/cedet/semantic/idle.el: Add local vars for autoloading.
(global-semantic-idle-scheduler-mode)
(semantic-idle-scheduler-mode): Autoload.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 05 Sep 2009 23:25:26 +0000 |
parents | 2bf481006ba4 |
children | 6ccad1511df1 |
rev | line source |
---|---|
104439
da5b2513c225
cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents:
104420
diff
changeset
|
1 ;;; semantic/chart.el --- Utilities for use with semantic tag tables |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
3 ;;; Copyright (C) 1999, 2000, 2001, 2003, 2005, 2008, 2009 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
4 ;;; Free Software Foundation, Inc. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 ;; Author: Eric M. Ludlam <zappo@gnu.org> |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 ;; This file is part of GNU Emacs. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 ;; GNU Emacs is free software: you can redistribute it and/or modify |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 ;; it under the terms of the GNU General Public License as published by |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; the Free Software Foundation, either version 3 of the License, or |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 ;; (at your option) any later version. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 ;; GNU Emacs is distributed in the hope that it will be useful, |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 ;; GNU General Public License for more details. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 ;; You should have received a copy of the GNU General Public License |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 ;;; Commentary: |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 ;; |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 ;; A set of simple functions for charting details about a file based on |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 ;; the output of the semantic parser. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 ;; |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 |
104439
da5b2513c225
cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents:
104420
diff
changeset
|
29 (require 'chart) |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
30 (require 'semantic) |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
31 (require 'semantic/db) |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
32 (require 'semantic/tag) |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
33 |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
34 (eval-when-compile (require 'semantic/find)) |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
35 |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
36 ;; (require 'semantic/db-mode) |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
37 ;; (require 'semantic/db-typecache) |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
38 ;; (require 'semantic/scope) |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
39 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
40 ;;; Code: |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 (defun semantic-chart-tags-by-class (&optional tagtable) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 "Create a bar chart representing the number of tags for a given tag class. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 Each bar represents how many toplevel tags in TAGTABLE |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 exist with a given class. See `semantic-symbol->name-assoc-list' |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
46 for tokens which will be charted. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 TAGTABLE is passedto `semantic-something-to-tag-table'." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
48 (interactive) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 (let* ((stream (semantic-something-to-tag-table |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 (or tagtable (current-buffer)))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 (names (mapcar 'cdr semantic-symbol->name-assoc-list)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 (nums (mapcar |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 (lambda (symname) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 (length |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 (semantic-brute-find-tag-by-class (car symname) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 stream) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
57 )) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 semantic-symbol->name-assoc-list))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 (chart-bar-quickie 'vertical |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 "Semantic Toplevel Tag Volume" |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 names "Tag Class" |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 nums "Volume") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 )) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 (defun semantic-chart-database-size (&optional tagtable) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 "Create a bar chart representing the size of each file in semanticdb. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 Each bar represents how many toplevel tags in TAGTABLE |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 exist in each database entry. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
69 TAGTABLE is passed to `semantic-something-to-tag-table'." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 (interactive) |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
71 (unless (and (fboundp 'semanticdb-minor-mode-p) |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
72 (semanticdb-minor-mode-p)) |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
73 (error "Semanticdb is not enabled")) |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 (let* ((db semanticdb-current-database) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 (dbt (semanticdb-get-database-tables db)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 (names (mapcar 'car |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 (object-assoc-list |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 'file |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 dbt))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 (numnuts (mapcar (lambda (dba) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 (prog1 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 (cons |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 (if (slot-boundp dba 'tags) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 (length (oref dba tags)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 1) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 (car names)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 (setq names (cdr names)))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 dbt)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 (nums nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 (fh (/ (- (frame-height) 7) 4))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 (setq numnuts (sort numnuts (lambda (a b) (> (car a) (car b))))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 (setq names (mapcar 'cdr numnuts) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 nums (mapcar 'car numnuts)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 (if (> (length names) fh) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 (progn |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 (setcdr (nthcdr fh names) nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 (setcdr (nthcdr fh nums) nil))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 (chart-bar-quickie 'horizontal |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 "Semantic DB Toplevel Tag Volume" |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 names "File" |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 nums "Volume") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 )) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 (defun semantic-chart-token-complexity (tok) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 "Calculate the `complexity' of token TOK." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 (count-lines |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 (semantic-tag-end tok) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 (semantic-tag-start tok))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 (defun semantic-chart-tag-complexity |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 (&optional class tagtable) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 "Create a bar chart representing the complexity of some tags. |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 Complexity is calculated for tags of CLASS. Each bar represents |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 the complexity of some tag in TAGTABLE. Only the most complex |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 items are charted. TAGTABLE is passedto |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 `semantic-something-to-tag-table'." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 (interactive) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 (let* ((sym (if (not class) 'function)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 (stream |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 (semantic-find-tags-by-class |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
121 sym (semantic-something-to-tag-table (or tagtable |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
122 (current-buffer))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 )) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 (name (cond ((semantic-tag-with-position-p (car stream)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 (buffer-name (semantic-tag-buffer (car stream)))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 (t ""))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 (cplx (mapcar (lambda (tok) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 (cons tok (semantic-chart-token-complexity tok))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 stream)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
130 (namelabel (cdr (assoc 'function semantic-symbol->name-assoc-list))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 (names nil) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
132 (nums nil)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
133 (setq cplx (sort cplx (lambda (a b) (> (cdr a) (cdr b))))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
134 (while (and cplx (<= (length names) (/ (- (frame-height) 7) 4))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 (setq names (cons (semantic-tag-name (car (car cplx))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 names) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 nums (cons (cdr (car cplx)) nums) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 cplx (cdr cplx))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 ;; ;; (setq names (mapcar (lambda (str) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
140 ;; ;; (substring str (- (length str) 10))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
141 ;; ;; names)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
142 (chart-bar-quickie 'horizontal |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
143 (format "%s Complexity in %s" |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
144 (capitalize (symbol-name sym)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
145 name) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
146 names namelabel |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
147 nums "Complexity (Lines of code)") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
148 )) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
149 |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
150 (declare-function semanticdb-get-typecache "semantic/db-typecache") |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
151 (declare-function semantic-calculate-scope "semantic/scope") |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
152 |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
153 (defun semantic-chart-analyzer () |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
154 "Chart the extent of the context analysis." |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
155 (interactive) |
104444
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
156 (require 'semantic/db-typecache) |
2bf481006ba4
lisp/Makefile.in: Ignore CEDET subdirectories when making subdirs.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
104442
diff
changeset
|
157 (require 'semantic/scope) |
104420
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
158 (let* ((p (semanticdb-find-translate-path nil nil)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
159 (plen (length p)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
160 (tab semanticdb-current-table) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
161 (tc (semanticdb-get-typecache tab)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
162 (tclen (+ (length (oref tc filestream)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
163 (length (oref tc includestream)))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
164 (scope (semantic-calculate-scope)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
165 (fslen (length (oref scope fullscope))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
166 (lvarlen (length (oref scope localvar))) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
167 ) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
168 (chart-bar-quickie 'vertical |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
169 (format "Analyzer Overhead in %s" (buffer-name)) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
170 '("includes" "typecache" "scopelen" "localvar") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
171 "Overhead Entries" |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
172 (list plen tclen fslen lvarlen) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
173 "Number of tags") |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
174 )) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
175 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
176 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
177 |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
178 (provide 'semantic/chart) |
2e15afd37998
cedet/semantic/adebug.el, cedet/semantic/chart.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
179 |
104439
da5b2513c225
cedet/cedet.el (cedet-packages): Bump srecode version.
Chong Yidong <cyd@stupidchicken.com>
parents:
104420
diff
changeset
|
180 ;;; semantic/chart.el ends here |